av_tempfile: fix leak in error case
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Oct 2012 15:09:57 +0000 (17:09 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Oct 2012 15:09:57 +0000 (17:09 +0200)
Fixes CID733796 Part2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/file.c

index 8dbeab6..5aa4b9c 100644 (file)
@@ -175,6 +175,7 @@ int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_c
     if (fd < 0) {
         int err = AVERROR(errno);
         av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
+        av_freep(filename);
         return err;
     }
     return fd; /* success */