1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/formats: Use av_realloc_array()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-13 23:15:16 +02:00
parent d03eefae4a
commit 0a7ad6bf51

View File

@ -39,8 +39,8 @@ do { \
type ***tmp; \ type ***tmp; \
int i; \ int i; \
\ \
if (!(tmp = av_realloc(ret->refs, \ if (!(tmp = av_realloc_array(ret->refs, ret->refcount + a->refcount, \
sizeof(*tmp) * (ret->refcount + a->refcount)))) \ sizeof(*tmp)))) \
goto fail; \ goto fail; \
ret->refs = tmp; \ ret->refs = tmp; \
\ \
@ -66,7 +66,7 @@ do {
goto fail; \ goto fail; \
\ \
if (count) { \ if (count) { \
if (!(ret->fmts = av_malloc(sizeof(*ret->fmts) * count))) \ if (!(ret->fmts = av_malloc_array(count, sizeof(*ret->fmts)))) \
goto fail; \ goto fail; \
for (i = 0; i < a->nb; i++) \ for (i = 0; i < a->nb; i++) \
for (j = 0; j < b->nb; j++) \ for (j = 0; j < b->nb; j++) \
@ -196,8 +196,8 @@ AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
ret_max = a->nb_channel_layouts + b->nb_channel_layouts; ret_max = a->nb_channel_layouts + b->nb_channel_layouts;
if (!(ret = av_mallocz(sizeof(*ret))) || if (!(ret = av_mallocz(sizeof(*ret))) ||
!(ret->channel_layouts = av_malloc(sizeof(*ret->channel_layouts) * !(ret->channel_layouts = av_malloc_array(ret_max,
ret_max))) sizeof(*ret->channel_layouts))))
goto fail; goto fail;
/* a[known] intersect b[known] */ /* a[known] intersect b[known] */
@ -284,7 +284,7 @@ int ff_fmt_is_in(int fmt, const int *fmts)
if (!formats) return NULL; \ if (!formats) return NULL; \
formats->count_field = count; \ formats->count_field = count; \
if (count) { \ if (count) { \
formats->field = av_malloc(sizeof(*formats->field)*count); \ formats->field = av_malloc_array(count, sizeof(*formats->field)); \
if (!formats->field) { \ if (!formats->field) { \
av_free(formats); \ av_free(formats); \
return NULL; \ return NULL; \