[FFmpeg-devel] [PATCH] avfilter/formats: replace non functional av_realloc() check by assert

Michael Niedermayer michaelni at gmx.at
Thu Mar 12 23:04:57 CET 2015


Simply returning on failure without indicating failure does not work
it instead crashes later, its better to fail immedeately until the
failure is handled.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavfilter/formats.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index f25328c..9e19613 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -416,8 +416,7 @@ AVFilterChannelLayouts *ff_all_channel_counts(void)
 do {                                                                 \
     *ref = f;                                                        \
     f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \
-    if (!f->refs)                                                    \
-        return;                                                      \
+    av_assert0(f->refs);                                             \
     f->refs[f->refcount-1] = ref;                                    \
 } while (0)
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list