aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-11-17 11:24:01 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-11-17 12:41:22 +0100
commitcb8c5e531c8d6b9d7a3efad4186df59efc043345 (patch)
treef7a5384bb63a7e42f91ab1a78cab7301d19abdab /cmdutils.c
parent1ba2e589cc334da2448d395e927ee269727b204c (diff)
downloadffmpeg-cb8c5e531c8d6b9d7a3efad4186df59efc043345.tar.gz
cmdutils: free the report file name.
Fix coverity issue 743443, which was a harmless leak.
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 5cdb183cc0..7e587de0ec 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -562,7 +562,7 @@ static void expand_filename_template(AVBPrint *bp, const char *template,
static int init_report(const char *env)
{
- const char *filename_template = "%p-%t.log";
+ char *filename_template = NULL;
char *key, *val;
int ret, count = 0;
time_t now;
@@ -586,6 +586,7 @@ static int init_report(const char *env)
env++;
count++;
if (!strcmp(key, "file")) {
+ av_free(filename_template);
filename_template = val;
val = NULL;
} else {
@@ -596,7 +597,9 @@ static int init_report(const char *env)
}
av_bprint_init(&filename, 0, 1);
- expand_filename_template(&filename, filename_template, tm);
+ expand_filename_template(&filename,
+ av_x_if_null(filename_template, "%p-%t.log"), tm);
+ av_free(filename_template);
if (!av_bprint_is_complete(&filename)) {
av_log(NULL, AV_LOG_ERROR, "Out of memory building report file name\n");
return AVERROR(ENOMEM);