Fix memleak in nuv demuxer: free packet already allocated packet when
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Thu, 9 Apr 2009 14:16:22 +0000 (14:16 +0000)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Thu, 9 Apr 2009 14:16:22 +0000 (14:16 +0000)
returning an error in nuv_packet.

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

libavformat/nuv.c

index a6e8e01..2f055b5 100644 (file)
@@ -226,7 +226,10 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
                 pkt->stream_index = ctx->v_id;
                 memcpy(pkt->data, hdr, copyhdrsize);
                 ret = get_buffer(pb, pkt->data + copyhdrsize, size);
-                if (ret < 0) return ret;
+                if (ret < 0) {
+                    av_free_packet(pkt);
+                    return ret;
+                }
                 if (ret < size)
                     av_shrink_packet(pkt, copyhdrsize + ret);
                 return 0;