[FFmpeg-devel] Fix leak when user preallocates a AVFormatContext, passes it to av_open_input_file, but file does not exist on disk
Art Clarke
aclarke
Thu Jul 2 23:47:32 CEST 2009
av_open_input_file takes memory ownership of *ic_ptr, and therefore must
free it if it nulls it. If you pass in your own AVFormatContext (i.e. you
pass in AVFormatParameters with prealloced_context>0), but then the file
doesn't exist on disk, the current code nulls the AVFormatContext pointer
without freeing it (while if av_open_input_stream fails, it will free it
before nulling it).
This patch makes the behavior consistent and patches a leak as a result.
- Art
--
http://www.xuggle.com/
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
video.
Use Xuggle to get the power of FFmpeg in Java.
-------------- next part --------------
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 19327)
+++ libavformat/utils.c (working copy)
@@ -499,6 +499,7 @@
av_freep(&pd->buf);
if (pb)
url_fclose(pb);
+ av_free(*ic_ptr);
*ic_ptr = NULL;
return err;
More information about the ffmpeg-devel
mailing list