Merge commit '5b220e1e19c17b202d83d9be0868d152109ae8f0'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 7 Aug 2014 20:11:37 +0000 (22:11 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 7 Aug 2014 20:11:37 +0000 (22:11 +0200)
* commit '5b220e1e19c17b202d83d9be0868d152109ae8f0':
  mpegts: Fix memory leaks and related crashes in mpegs_write_header()

Conflicts:
libavformat/mpegtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mpegtsenc.c

@@@ -609,9 -499,11 +618,11 @@@ static int mpegts_write_header(AVFormat
      ts->sdt.write_packet = section_write_packet;
      ts->sdt.opaque       = s;
  
 -    pids = av_malloc(s->nb_streams * sizeof(*pids));
 +    pids = av_malloc_array(s->nb_streams, sizeof(*pids));
-     if (!pids)
+     if (!pids) {
+         av_free(service);
          return AVERROR(ENOMEM);
+     }
  
      /* assign pids to each stream */
      for (i = 0; i < s->nb_streams; i++) {