matroskadec: avoid potential mem leak
authorAurelien Jacobs <aurel@gnuage.org>
Mon, 2 Jun 2008 23:27:14 +0000 (23:27 +0000)
committerAurelien Jacobs <aurel@gnuage.org>
Mon, 2 Jun 2008 23:27:14 +0000 (23:27 +0000)
fix CID120

Originally committed as revision 13635 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskadec.c

index e203329..e2990e4 100644 (file)
@@ -2962,6 +2962,7 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
                 pkt = av_mallocz(sizeof(AVPacket));
                 /* XXX: prevent data copy... */
                 if (av_new_packet(pkt, pkt_size+offset) < 0) {
+                    av_free(pkt);
                     res = AVERROR(ENOMEM);
                     n = laces-1;
                     break;