lavfi/formats: fix segfault when allocation fails
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>
Sat, 5 Dec 2015 18:09:24 +0000 (13:09 -0500)
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>
Fri, 11 Dec 2015 15:21:47 +0000 (10:21 -0500)
This is a somewhat subtle failure that can occur when the realloc_array
fails in FORMATS_REF.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
libavfilter/formats.c

index 2b13cbf..95a6b11 100644 (file)
@@ -445,7 +445,7 @@ do {                                        \
 do {                                                               \
     int idx = -1;                                                  \
                                                                    \
-    if (!*ref)                                                     \
+    if (!*ref || !(*ref)->refs)                                    \
         return;                                                    \
                                                                    \
     FIND_REF_INDEX(ref, idx);                                      \