[FFmpeg-cvslog] avcodec/ass_split: use *alloc_array()

Michael Niedermayer git at videolan.org
Fri Jan 9 20:45:46 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan  9 20:20:00 2015 +0100| [aefb99f2c0554a10f695eed569f0b94d7e462a34] | committer: Michael Niedermayer

avcodec/ass_split: use *alloc_array()

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

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

 libavcodec/ass_split.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index cc4f961..2458cb9 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -207,7 +207,7 @@ static uint8_t *realloc_section_array(ASSSplitContext *ctx)
     const ASSSection *section = &ass_sections[ctx->current_section];
     int *count = (int *)((uint8_t *)&ctx->ass + section->offset_count);
     void **section_ptr = (void **)((uint8_t *)&ctx->ass + section->offset);
-    uint8_t *tmp = av_realloc(*section_ptr, (*count+1)*section->size);
+    uint8_t *tmp = av_realloc_array(*section_ptr, (*count+1), section->size);
     if (!tmp)
         return NULL;
     *section_ptr = tmp;
@@ -232,7 +232,7 @@ static inline const char *skip_space(const char *buf)
 static int *get_default_field_orders(const ASSSection *section)
 {
     int i;
-    int *order = av_malloc(FF_ARRAY_ELEMS(section->fields) * sizeof(*order));
+    int *order = av_malloc_array(FF_ARRAY_ELEMS(section->fields), sizeof(*order));
 
     if (!order)
         return NULL;
@@ -265,7 +265,7 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf)
             while (!is_eol(*buf)) {
                 buf = skip_space(buf);
                 len = strcspn(buf, ", \r\n");
-                if (!(tmp = av_realloc(order, (*number + 1) * sizeof(*order))))
+                if (!(tmp = av_realloc_array(order, (*number + 1), sizeof(*order))))
                     return NULL;
                 order = tmp;
                 order[*number] = -1;



More information about the ffmpeg-cvslog mailing list