[FFmpeg-cvslog] avfilter/vf_removelogo: fix memleak on failure

Michael Niedermayer git at videolan.org
Sat May 10 21:45:50 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May 10 21:29:24 2014 +0200| [6b9e0bf42fb360a150e08b8eb6404ac1ed66ef7e] | committer: Michael Niedermayer

avfilter/vf_removelogo: fix memleak on failure

Fixes CID751770

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b9e0bf42fb360a150e08b8eb6404ac1ed66ef7e
---

 libavfilter/vf_removelogo.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c
index 01a585c..889050b 100644
--- a/libavfilter/vf_removelogo.c
+++ b/libavfilter/vf_removelogo.c
@@ -318,12 +318,16 @@ static av_cold int init(AVFilterContext *ctx)
 
     for (a = 0; a <= s->max_mask_size; a++) {
         mask[a] = (int **)av_malloc(sizeof(int *) * ((a * 2) + 1));
-        if (!mask[a])
+        if (!mask[a]) {
+            av_free(mask);
             return AVERROR(ENOMEM);
+        }
         for (b = -a; b <= a; b++) {
             mask[a][b + a] = (int *)av_malloc(sizeof(int) * ((a * 2) + 1));
-            if (!mask[a][b + a])
+            if (!mask[a][b + a]) {
+                av_free(mask);
                 return AVERROR(ENOMEM);
+            }
             for (c = -a; c <= a; c++) {
                 if ((b * b) + (c * c) <= (a * a)) /* Circular 0/1 mask. */
                     mask[a][b + a][c + a] = 1;



More information about the ffmpeg-cvslog mailing list