avformat/pcmdec: fix memory leak
authorTimo Rothenpieler <timo@rothenpieler.org>
Sun, 11 Jun 2017 13:19:17 +0000 (15:19 +0200)
committerTimo Rothenpieler <timo@rothenpieler.org>
Tue, 13 Jun 2017 17:49:06 +0000 (19:49 +0200)
Fixes CID 1396267

libavformat/pcmdec.c

index 3c7e8ac..d0ceea6 100644 (file)
@@ -68,6 +68,7 @@ static int pcm_read_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR,
                        "Invalid sample_rate found in mime_type \"%s\"\n",
                        mime_type);
+                av_freep(&mime_type);
                 return AVERROR_INVALIDDATA;
             }
             st->codecpar->sample_rate = rate;
@@ -75,6 +76,7 @@ static int pcm_read_header(AVFormatContext *s)
                 st->codecpar->channels = channels;
         }
     }
+    av_freep(&mime_type);
 
     st->codecpar->bits_per_coded_sample =
         av_get_bits_per_sample(st->codecpar->codec_id);