ffprobe: fix NULL pointer dereference in writer_close()
authorStefano Sabatini <stefasab@gmail.com>
Thu, 5 Jan 2012 10:00:12 +0000 (11:00 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Fri, 6 Jan 2012 09:43:34 +0000 (10:43 +0100)
Fix crash.

ffprobe.c

index ee3c899..77c343a 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -178,9 +178,11 @@ static const AVClass writer_class = {
 
 static void writer_close(WriterContext **wctx)
 {
-    if (*wctx && (*wctx)->writer->uninit)
-        (*wctx)->writer->uninit(*wctx);
+    if (!*wctx)
+        return;
 
+    if ((*wctx)->writer->uninit)
+        (*wctx)->writer->uninit(*wctx);
     av_freep(&((*wctx)->priv));
     av_freep(wctx);
 }