[Ffmpeg-devel] [PATCH] catch OOM in av_interleave_packet_per_dts
Michael Niedermayer
michaelni
Sun Mar 25 21:20:22 CEST 2007
Hi
On Sun, Mar 25, 2007 at 02:35:54PM -0000, Wolfram Gloger wrote:
> Hi,
>
> This avoids a crash when running out of memory in
> av_interleave_packet_per_dts. It also changes av_mallocz to av_malloc
> in that location, as all the allocated data is initialized immediately
> afterwards.
>
> Regards,
> Wolfram
>
> diff -Nur -x .svn trunk/libavformat/utils.c ffmpeg-wg/libavformat/utils.c
> --- trunk/libavformat/utils.c 2007-03-23 12:25:32.000000000 +0100
> +++ ffmpeg-wg/libavformat/utils.c 2007-03-25 15:03:43.000000000 +0200
> @@ -2182,11 +2182,13 @@
> int streams[MAX_STREAMS];
>
> if(pkt){
> - AVStream *st= s->streams[ pkt->stream_index];
> + const AVStream *st= s->streams[ pkt->stream_index];
unrealated?
> // assert(pkt->destruct != av_destruct_packet); //FIXME
>
> - this_pktl = av_mallocz(sizeof(AVPacketList));
> + this_pktl = av_malloc(sizeof(AVPacketList));
ok
> + if(!this_pktl)
> + return -2; // -1 already used up in av_interleaved_write_frame
AVERROR(ENOMEM)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070325/0696f198/attachment.pgp>
More information about the ffmpeg-devel
mailing list