Browse code

avfilter/vsrc_life: use av_calloc()

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2013/09/13 18:25:32
Showing 1 changed files
... ...
@@ -194,8 +194,8 @@ static int init_pattern_from_file(AVFilterContext *ctx)
194 194
         life->h = h;
195 195
     }
196 196
 
197
-    if (!(life->buf[0] = av_mallocz(sizeof(char) * life->h * life->w)) ||
198
-        !(life->buf[1] = av_mallocz(sizeof(char) * life->h * life->w))) {
197
+    if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) ||
198
+        !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) {
199 199
         av_free(life->buf[0]);
200 200
         av_free(life->buf[1]);
201 201
         return AVERROR(ENOMEM);
... ...
@@ -236,8 +236,8 @@ static int init(AVFilterContext *ctx)
236 236
         /* fill the grid randomly */
237 237
         int i;
238 238
 
239
-        if (!(life->buf[0] = av_mallocz(sizeof(char) * life->h * life->w)) ||
240
-            !(life->buf[1] = av_mallocz(sizeof(char) * life->h * life->w))) {
239
+        if (!(life->buf[0] = av_calloc(life->h * life->w, sizeof(*life->buf[0]))) ||
240
+            !(life->buf[1] = av_calloc(life->h * life->w, sizeof(*life->buf[1])))) {
241 241
             av_free(life->buf[0]);
242 242
             av_free(life->buf[1]);
243 243
             return AVERROR(ENOMEM);