[FFmpeg-cvslog] lavf: don't try to free private options if priv_data is NULL.

Anton Khirnov git at videolan.org
Thu Jun 9 05:16:06 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Jun  6 13:14:05 2011 +0200| [dbaba52ed25f79c8be0ce1a478b229bf868f8c11] | committer: Anton Khirnov

lavf: don't try to free private options if priv_data is NULL.

This might happen if there was an error before priv_data was allocated
and result in segfault.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbaba52ed25f79c8be0ce1a478b229bf868f8c11
---

 libavformat/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8ab59e1..c198af0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2551,7 +2551,7 @@ void avformat_free_context(AVFormatContext *s)
     AVStream *st;
 
     av_opt_free(s);
-    if (s->iformat && s->iformat->priv_class)
+    if (s->iformat && s->iformat->priv_class && s->priv_data)
         av_opt_free(s->priv_data);
 
     for(i=0;i<s->nb_streams;i++) {



More information about the ffmpeg-cvslog mailing list