diff options
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 2 | ||||
-rw-r--r-- | libavformat/hashenc.c | 6 | ||||
-rw-r--r-- | libavformat/hdsenc.c | 2 | ||||
-rw-r--r-- | libavformat/icoenc.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 2 | ||||
-rw-r--r-- | libavformat/mov.c | 6 | ||||
-rw-r--r-- | libavformat/movenc.c | 2 | ||||
-rw-r--r-- | libavformat/mxfdec.c | 8 | ||||
-rw-r--r-- | libavformat/protocols.c | 2 | ||||
-rw-r--r-- | libavformat/rtspdec.c | 2 | ||||
-rw-r--r-- | libavformat/sapenc.c | 2 | ||||
-rw-r--r-- | libavformat/smoothstreamingenc.c | 2 | ||||
-rw-r--r-- | libavformat/tee.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 4 | ||||
-rw-r--r-- | libavformat/wavenc.c | 4 | ||||
-rw-r--r-- | libavformat/xmv.c | 2 |
16 files changed, 24 insertions, 26 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 3eb5d4dff5..b09a715d86 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1674,7 +1674,7 @@ static int check_stream_max_drift(AVFormatContext *s) { int64_t min_pos, pos; int i; - int *idx = av_mallocz_array(s->nb_streams, sizeof(*idx)); + int *idx = av_calloc(s->nb_streams, sizeof(*idx)); if (!idx) return AVERROR(ENOMEM); for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) { diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index a3b4a2e11e..622491d2e5 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -84,7 +84,7 @@ static int hash_init(struct AVFormatContext *s) int res; struct HashContext *c = s->priv_data; c->per_stream = 0; - c->hashes = av_mallocz_array(1, sizeof(*c->hashes)); + c->hashes = av_mallocz(sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); res = av_hash_alloc(&c->hashes[0], c->hash_name); @@ -101,7 +101,7 @@ static int streamhash_init(struct AVFormatContext *s) int res, i; struct HashContext *c = s->priv_data; c->per_stream = 1; - c->hashes = av_mallocz_array(s->nb_streams, sizeof(*c->hashes)); + c->hashes = av_calloc(s->nb_streams, sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); for (i = 0; i < s->nb_streams; i++) { @@ -254,7 +254,7 @@ static int framehash_init(struct AVFormatContext *s) int res; struct HashContext *c = s->priv_data; c->per_stream = 0; - c->hashes = av_mallocz_array(1, sizeof(*c->hashes)); + c->hashes = av_mallocz(sizeof(*c->hashes)); if (!c->hashes) return AVERROR(ENOMEM); res = av_hash_alloc(&c->hashes[0], c->hash_name); diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index a603d5067e..e5353bac65 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -326,7 +326,7 @@ static int hds_write_header(AVFormatContext *s) return AVERROR_MUXER_NOT_FOUND; } - c->streams = av_mallocz_array(s->nb_streams, sizeof(*c->streams)); + c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); if (!c->streams) { return AVERROR(ENOMEM); } diff --git a/libavformat/icoenc.c b/libavformat/icoenc.c index a1ca15155f..ee793137fd 100644 --- a/libavformat/icoenc.c +++ b/libavformat/icoenc.c @@ -106,7 +106,7 @@ static int ico_write_header(AVFormatContext *s) avio_skip(pb, 16); } - ico->images = av_mallocz_array(ico->nb_images, sizeof(IcoMuxContext)); + ico->images = av_calloc(ico->nb_images, sizeof(*ico->images)); if (!ico->images) return AVERROR(ENOMEM); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index b900937e82..039f20988a 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2687,7 +2687,7 @@ static int mkv_init(struct AVFormatContext *s) mkv->cur_audio_pkt = av_packet_alloc(); if (!mkv->cur_audio_pkt) return AVERROR(ENOMEM); - mkv->tracks = av_mallocz_array(s->nb_streams, sizeof(*mkv->tracks)); + mkv->tracks = av_calloc(s->nb_streams, sizeof(*mkv->tracks)); if (!mkv->tracks) return AVERROR(ENOMEM); diff --git a/libavformat/mov.c b/libavformat/mov.c index 239c09fb9a..ca14646a38 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2600,11 +2600,11 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) } /* Prepare space for hosting multiple extradata. */ - sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata)); + sc->extradata = av_calloc(entries, sizeof(*sc->extradata)); if (!sc->extradata) return AVERROR(ENOMEM); - sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size)); + sc->extradata_size = av_calloc(entries, sizeof(*sc->extradata_size)); if (!sc->extradata_size) { ret = AVERROR(ENOMEM); goto fail; @@ -6009,7 +6009,7 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt if (use_subsamples) { subsample_count = avio_rb16(pb); av_free((*sample)->subsamples); - (*sample)->subsamples = av_mallocz_array(subsample_count, sizeof(*subsamples)); + (*sample)->subsamples = av_calloc(subsample_count, sizeof(*subsamples)); if (!(*sample)->subsamples) { av_encryption_info_free(*sample); *sample = NULL; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d5929e6395..cfb5a5c725 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6670,7 +6670,7 @@ static int mov_init(AVFormatContext *s) // Reserve an extra stream for chapters for the case where chapters // are written in the trailer - mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); + mov->tracks = av_calloc(mov->nb_streams + 1, sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 062ae322b3..a6ead28fe4 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1872,8 +1872,8 @@ static int mxf_compute_index_tables(MXFContext *mxf) } } - mxf->index_tables = av_mallocz_array(mxf->nb_index_tables, - sizeof(*mxf->index_tables)); + mxf->index_tables = av_calloc(mxf->nb_index_tables, + sizeof(*mxf->index_tables)); if (!mxf->index_tables) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n"); ret = AVERROR(ENOMEM); @@ -1894,9 +1894,7 @@ static int mxf_compute_index_tables(MXFContext *mxf) MXFIndexTable *t = &mxf->index_tables[j]; MXFTrack *mxf_track = NULL; - t->segments = av_mallocz_array(t->nb_segments, - sizeof(*t->segments)); - + t->segments = av_calloc(t->nb_segments, sizeof(*t->segments)); if (!t->segments) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment" " pointer array\n"); diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 7f08f151b6..b108aa6c7e 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -122,7 +122,7 @@ const URLProtocol **ffurl_get_protocols(const char *whitelist, const URLProtocol **ret; int i, ret_idx = 0; - ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret)); + ret = av_calloc(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret)); if (!ret) return NULL; diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 6e97c23330..0e91e3e315 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -748,7 +748,7 @@ static int rtsp_read_header(AVFormatContext *s) return ret; rt->real_setup_cache = !s->nb_streams ? NULL : - av_mallocz_array(s->nb_streams, 2 * sizeof(*rt->real_setup_cache)); + av_calloc(s->nb_streams, 2 * sizeof(*rt->real_setup_cache)); if (!rt->real_setup_cache && s->nb_streams) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 1374a09906..9319ee6f80 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -133,7 +133,7 @@ static int sap_write_header(AVFormatContext *s) freeaddrinfo(ai); } - contexts = av_mallocz_array(s->nb_streams, sizeof(AVFormatContext*)); + contexts = av_calloc(s->nb_streams, sizeof(*contexts)); if (!contexts) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 36330b17b6..27b59c299c 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -295,7 +295,7 @@ static int ism_write_header(AVFormatContext *s) return AVERROR_MUXER_NOT_FOUND; } - c->streams = av_mallocz_array(s->nb_streams, sizeof(*c->streams)); + c->streams = av_calloc(s->nb_streams, sizeof(*c->streams)); if (!c->streams) { return AVERROR(ENOMEM); } diff --git a/libavformat/tee.c b/libavformat/tee.c index 759535bdea..bb31218ac5 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -475,7 +475,7 @@ static int tee_write_header(AVFormatContext *avf) filename++; } - if (!(tee->slaves = av_mallocz_array(nb_slaves, sizeof(*tee->slaves)))) { + if (!FF_ALLOCZ_TYPED_ARRAY(tee->slaves, nb_slaves)) { ret = AVERROR(ENOMEM); goto fail; } diff --git a/libavformat/utils.c b/libavformat/utils.c index 3e6b6a1e23..2157f93e7b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -612,8 +612,8 @@ int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src) /* Copy side data if present */ if (src->nb_side_data) { - dst->side_data = av_mallocz_array(src->nb_side_data, - sizeof(AVPacketSideData)); + dst->side_data = av_calloc(src->nb_side_data, + sizeof(*dst->side_data)); if (!dst->side_data) return AVERROR(ENOMEM); dst->nb_side_data = src->nb_side_data; diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c index 06e6047032..2317700be1 100644 --- a/libavformat/wavenc.c +++ b/libavformat/wavenc.c @@ -174,8 +174,8 @@ static av_cold int peak_init_writer(AVFormatContext *s) return AVERROR(ERANGE); wav->size_increment = par->channels * wav->peak_bps * wav->peak_ppv; - wav->peak_maxpos = av_mallocz_array(par->channels, sizeof(*wav->peak_maxpos)); - wav->peak_maxneg = av_mallocz_array(par->channels, sizeof(*wav->peak_maxneg)); + wav->peak_maxpos = av_calloc(par->channels, sizeof(*wav->peak_maxpos)); + wav->peak_maxneg = av_calloc(par->channels, sizeof(*wav->peak_maxneg)); if (!wav->peak_maxpos || !wav->peak_maxneg) goto nomem; diff --git a/libavformat/xmv.c b/libavformat/xmv.c index fbe0f484e2..ec21a4f853 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -175,7 +175,7 @@ static int xmv_read_header(AVFormatContext *s) avio_skip(pb, 2); /* Unknown (padding?) */ - xmv->audio = av_mallocz_array(xmv->audio_track_count, sizeof(XMVAudioPacket)); + xmv->audio = av_calloc(xmv->audio_track_count, sizeof(*xmv->audio)); if (!xmv->audio) return AVERROR(ENOMEM); |