avformat/mpegtsenc: Free services array completely on failure
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 7 Aug 2014 20:41:29 +0000 (22:41 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 7 Aug 2014 21:04:23 +0000 (23:04 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mpegtsenc.c

index 5ecc7fb..4c5e289 100644 (file)
@@ -778,7 +778,6 @@ static int mpegts_write_header(AVFormatContext *s)
     return 0;
 
 fail:
-    av_free(service);
     av_free(pids);
     for (i = 0; i < s->nb_streams; i++) {
         st    = s->streams[i];
@@ -792,6 +791,14 @@ fail:
         }
         av_freep(&st->priv_data);
     }
+
+    for (i = 0; i < ts->nb_services; i++) {
+        service = ts->services[i];
+        av_freep(&service->provider_name);
+        av_freep(&service->name);
+        av_free(service);
+    }
+    av_free(ts->services);
     return ret;
 }