mpegts: Fix potential memory leak in mpegts_read_packet()
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Sep 2012 02:32:25 +0000 (04:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Sep 2012 03:21:47 +0000 (05:21 +0200)
This leak can happen in case of some error paths.

Found-by: Tanami, Ohad
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mpegts.c

index 4492c5b..04e10b6 100644 (file)
@@ -2066,6 +2066,7 @@ static int mpegts_read_packet(AVFormatContext *s,
     ts->pkt = pkt;
     ret = handle_packets(ts, 0);
     if (ret < 0) {
+        av_free_packet(ts->pkt);
         /* flush pes data left */
         for (i = 0; i < NB_PID_MAX; i++) {
             if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {