summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorArt Clarke <aclarke@vlideshow.com>2009-07-15 10:00:16 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2009-07-15 10:00:16 +0000
commitebb82604b0b14c79917466107c39592a20e5b0c5 (patch)
treec193c8a584f443ee35dd4c6f6c3ac22fda8d8f6e /libavformat/utils.c
parent65b875d8fcc2a40cc45b41516c4bec4f90909b20 (diff)
Only free '*ic_ptr' when a caller has pre-allocated a context and passed it in
(wherein av_open_input_file assumes memory ownership). Patch by Art Clarke a<surname> xuggle com Originally committed as revision 19436 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3fce3fa87b..0c1a50d816 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -499,7 +499,9 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
av_freep(&pd->buf);
if (pb)
url_fclose(pb);
- av_freep(ic_ptr);
+ if (ap && ap->prealloced_context)
+ av_free(*ic_ptr);
+ *ic_ptr = NULL;
return err;
}