Fix memleak in nuv demuxer: free packet already allocated packet when

returning an error in nuv_packet.

Originally committed as revision 18385 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger 2009-04-09 14:16:22 +00:00
parent 7a709548a7
commit ef12ec23fa
1 changed files with 4 additions and 1 deletions

View 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;