[FFmpeg-cvslog] concatdec: fix metadata memleak on error

Marton Balint git at videolan.org
Mon Oct 5 00:42:47 CEST 2015


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Oct  3 23:48:38 2015 +0200| [80b6cc4214a8d90e50ebb49ff1088c3223d2c680] | committer: Marton Balint

concatdec: fix metadata memleak on error

Fixes Coverity CID 1323077.

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80b6cc4214a8d90e50ebb49ff1088c3223d2c680
---

 libavformat/concatdec.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 88b6dbe..832b7f4 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -389,16 +389,16 @@ static int concat_read_header(AVFormatContext *avf)
                 file->outpoint = dur;
         } else if (!strcmp(keyword, "file_packet_metadata")) {
             char *metadata;
-            metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
-            if (!metadata) {
-                av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
-                FAIL(AVERROR_INVALIDDATA);
-            }
             if (!file) {
                 av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
                        line, keyword);
                 FAIL(AVERROR_INVALIDDATA);
             }
+            metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
+            if (!metadata) {
+                av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
+                FAIL(AVERROR_INVALIDDATA);
+            }
             if ((ret = av_dict_parse_string(&file->metadata, metadata, "=", "", 0)) < 0) {
                 av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line);
                 av_freep(&metadata);



More information about the ffmpeg-cvslog mailing list