aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/asfenc.c
diff options
context:
space:
mode:
authorAlexandra Khirnova <alexandra.khirnova@gmail.com>2013-09-10 11:57:35 +0200
committerDiego Biurrun <diego@biurrun.de>2013-09-10 12:38:32 +0200
commitf369b9356c4606cd4d713d60f7db5de119d901fa (patch)
tree174e199dd9716a32fbee4fb235d3938721fb333f /libavformat/asfenc.c
parentbdf990425e2be6912a6d29f032ca558448c8635a (diff)
downloadffmpeg-f369b9356c4606cd4d713d60f7db5de119d901fa.tar.gz
avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavformat/asfenc.c')
-rw-r--r--libavformat/asfenc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index a523b3a051..6be285c531 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -788,10 +788,14 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) {
for (i = asf->nb_index_count; i < start_sec; i++) {
if (i >= asf->nb_index_memory_alloc) {
+ int err;
asf->nb_index_memory_alloc += ASF_INDEX_BLOCK;
- asf->index_ptr = (ASFIndex *)av_realloc(asf->index_ptr,
- sizeof(ASFIndex) *
- asf->nb_index_memory_alloc);
+ if ((err = av_reallocp_array(&asf->index_ptr,
+ asf->nb_index_memory_alloc,
+ sizeof(*asf->index_ptr))) < 0) {
+ asf->nb_index_memory_alloc = 0;
+ return err;
+ }
}
// store
asf->index_ptr[i].packet_number = (uint32_t)packet_st;