From 863ee8a855b8ce27ffef41479eb66da58763faed Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 17 Nov 2014 00:22:20 +0100 Subject: lavfi: clean memory on error in ADD_FORMAT() CC: libav-stable@libav.org Bug-Id: CID 1250334 --- libavfilter/formats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavfilter/formats.c') diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 24a4fab0d1..ea61ed2da6 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -188,8 +188,10 @@ do { \ \ fmts = av_realloc((*f)->list, \ sizeof(*(*f)->list) * ((*f)->nb + 1));\ - if (!fmts) \ + if (!fmts) { \ + av_freep(&f); \ return AVERROR(ENOMEM); \ + } \ \ (*f)->list = fmts; \ (*f)->list[(*f)->nb++] = fmt; \ -- cgit v1.2.3