[FFmpeg-devel] [RFC] missing av_free_packet on error?

Michael Niedermayer michaelni
Thu Jul 10 22:31:32 CEST 2008


On Thu, Jul 10, 2008 at 09:53:15PM +0200, Reimar D?ffinger wrote:
> Hello,
> I have been trying to fix
> http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1136
> and thus noticed the following code in libavformat/eacdata.c:
> ================================
> if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
>    return AVERROR(EIO);
> ================================
> 
> Whereas av_find_stream_info() assumes that if there is an error, there
> is no packet to free.
> My question is: where is the error, where should it be fixed?
> In the demuxer, in av_find_stream_info, av_read_... or maybe this check
> should be moved to av_get_packet, to make it always fail when not all
> requested data could be read?
> IMO in the demuxer, in which case I suggest this change:

Your change is buggy.
You either need to limit the freeing for >=0 return or
make av_new_packet() set data=NULL in case of malloc failure

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080710/5d810155/attachment.pgp>



More information about the ffmpeg-devel mailing list