avformat/ico: use avmalloc(z)_array()
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 16 Apr 2014 17:41:41 +0000 (19:41 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 16 Apr 2014 17:41:41 +0000 (19:41 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/icodec.c
libavformat/icoenc.c

index 4c038e9..847f0ee 100644 (file)
@@ -58,7 +58,7 @@ static int read_header(AVFormatContext *s)
     avio_skip(pb, 4);
     ico->nb_images = avio_rl16(pb);
 
-    ico->images = av_malloc(ico->nb_images * sizeof(IcoImage));
+    ico->images = av_malloc_array(ico->nb_images, sizeof(IcoImage));
     if (!ico->images)
         return AVERROR(ENOMEM);
 
index 561c6ca..dcf9065 100644 (file)
@@ -101,7 +101,7 @@ static int ico_write_header(AVFormatContext *s)
         avio_skip(pb, 16);
     }
 
-    ico->images = av_mallocz(ico->nb_images * sizeof(IcoMuxContext));
+    ico->images = av_mallocz_array(ico->nb_images, sizeof(IcoMuxContext));
     if (!ico->images)
         return AVERROR(ENOMEM);