summaryrefslogtreecommitdiffstats
path: root/libavcodec/ass_split.c
diff options
context:
space:
mode:
authorFan Gang <fangang@sbrella.com>2018-02-13 15:38:59 +0800
committerPaul B Mahol <onemda@gmail.com>2018-12-14 14:19:50 +0100
commitc6e1966c1a1a8987de0834462d7a76377eaa76bc (patch)
tree6c0fe6d6445d88c33d06c4bd5e34a0ee9083cf0f /libavcodec/ass_split.c
parentddefd05507fdf4391485f9985e80e4672486dbfd (diff)
downloadffmpeg-streaming-c6e1966c1a1a8987de0834462d7a76377eaa76bc.zip
ffmpeg-streaming-c6e1966c1a1a8987de0834462d7a76377eaa76bc.tar.gz
avcodec/ass_split: fix a memory leak defect when realloc fails
Fixes #7019.
Diffstat (limited to 'libavcodec/ass_split.c')
-rw-r--r--libavcodec/ass_split.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index 872528b..67da7c6 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -249,7 +249,7 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf)
const ASSSection *section = &ass_sections[ctx->current_section];
int *number = &ctx->field_number[ctx->current_section];
int *order = ctx->field_order[ctx->current_section];
- int *tmp, i, len;
+ int i, len;
while (buf && *buf) {
if (buf[0] == '[') {
@@ -280,9 +280,9 @@ 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_array(order, (*number + 1), sizeof(*order))))
+ if (av_reallocp_array(&order, (*number + 1), sizeof(*order)) != 0)
return NULL;
- order = tmp;
+
order[*number] = -1;
for (i=0; section->fields[i].name; i++)
if (!strncmp(buf, section->fields[i].name, len)) {
OpenPOWER on IntegriCloud