avformat/id3v2: fix memleak with empty strings
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 11 Aug 2016 12:10:19 +0000 (14:10 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 11 Aug 2016 12:10:19 +0000 (14:10 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/id3v2.c

index 921a7c2..9969d7a 100644 (file)
@@ -422,7 +422,10 @@ static void read_comment(AVFormatContext *s, AVIOContext *pb, int taglen,
         return;
     }
 
-    if (dst && dst[0]) {
+    if (dst && !*dst)
+        av_freep(&dst);
+
+    if (dst) {
         key = (const char *) dst;
         dict_flags |= AV_DICT_DONT_STRDUP_KEY;
     }