aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/gxfenc.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/gxfenc.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/gxfenc.c')
-rw-r--r--libavformat/gxfenc.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 128122f9d9..74df237e61 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -342,11 +342,13 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
if (!rewrite) {
if (!(gxf->map_offsets_nb % 30)) {
- gxf->map_offsets = av_realloc(gxf->map_offsets,
- (gxf->map_offsets_nb+30)*sizeof(*gxf->map_offsets));
- if (!gxf->map_offsets) {
+ int err;
+ if ((err = av_reallocp_array(&gxf->map_offsets,
+ gxf->map_offsets_nb + 30,
+ sizeof(*gxf->map_offsets))) < 0) {
+ gxf->map_offsets_nb = 0;
av_log(s, AV_LOG_ERROR, "could not realloc map offsets\n");
- return -1;
+ return err;
}
}
gxf->map_offsets[gxf->map_offsets_nb++] = pos; // do not increment here
@@ -873,11 +875,13 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (!(gxf->flt_entries_nb % 500)) {
- gxf->flt_entries = av_realloc(gxf->flt_entries,
- (gxf->flt_entries_nb+500)*sizeof(*gxf->flt_entries));
- if (!gxf->flt_entries) {
+ int err;
+ if ((err = av_reallocp_array(&gxf->flt_entries,
+ gxf->flt_entries_nb + 500,
+ sizeof(*gxf->flt_entries))) < 0) {
+ gxf->flt_entries_nb = 0;
av_log(s, AV_LOG_ERROR, "could not reallocate flt entries\n");
- return -1;
+ return err;
}
}
gxf->flt_entries[gxf->flt_entries_nb++] = packet_start_offset;