Browse code

avfilter/vsrc_life: Use av_freep() avoid leaving stale pointers in memory

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

Michael Niedermayer authored on 2014/12/19 23:04:56
Showing 1 changed files
... ...
@@ -196,8 +196,8 @@ static int init_pattern_from_file(AVFilterContext *ctx)
196 196
 
197 197
     if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) ||
198 198
         !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) {
199
-        av_free(life->buf[0]);
200
-        av_free(life->buf[1]);
199
+        av_freep(&life->buf[0]);
200
+        av_freep(&life->buf[1]);
201 201
         return AVERROR(ENOMEM);
202 202
     }
203 203
 
... ...
@@ -238,8 +238,8 @@ static av_cold int init(AVFilterContext *ctx)
238 238
 
239 239
         if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) ||
240 240
             !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) {
241
-            av_free(life->buf[0]);
242
-            av_free(life->buf[1]);
241
+            av_freep(&life->buf[0]);
242
+            av_freep(&life->buf[1]);
243 243
             return AVERROR(ENOMEM);
244 244
         }
245 245
         if (life->random_seed == -1)