lavf: don't try to free private options if priv_data is NULL.
authorAnton Khirnov <anton@khirnov.net>
Mon, 6 Jun 2011 11:14:05 +0000 (13:14 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 8 Jun 2011 17:51:31 +0000 (19:51 +0200)
This might happen if there was an error before priv_data was allocated
and result in segfault.

libavformat/utils.c

index 8ab59e1..c198af0 100644 (file)
@@ -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++) {