avformat: Make avformat_free_context handle NULL
authorLuca Barbato <lu_zero@gentoo.org>
Wed, 15 Oct 2014 00:35:55 +0000 (02:35 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 12 Jan 2015 22:58:25 +0000 (23:58 +0100)
Work as the other free()-like functions.

Bug-Id: CID 1087081
CC: libav-stable@libav.org
libavformat/utils.c

index 73e3039..94431e1 100644 (file)
@@ -2447,6 +2447,9 @@ void avformat_free_context(AVFormatContext *s)
     int i, j;
     AVStream *st;
 
+    if (!s)
+        return;
+
     av_opt_free(s);
     if (s->iformat && s->iformat->priv_class && s->priv_data)
         av_opt_free(s->priv_data);