Commit 2f73128f authored by Stefan Westerfeld's avatar Stefan Westerfeld

avfilter/asubprocess: add more out-of-memory checks

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 9b41c7cd
......@@ -80,6 +80,8 @@ static SPB *spb_new(AVFilterContext *ctx)
}
else {
spb = av_malloc(sizeof(SPB));
if (!spb)
return NULL;
}
spb->next = NULL;
......@@ -355,8 +357,11 @@ sp_write(AVFilterContext *ctx, char *buffer, int count)
SPB *last;
int rc, ret;
if (!sp->out_buffers)
if (!sp->out_buffers) {
sp->out_buffers = spb_new(ctx);
if (!sp->out_buffers)
return AVERROR(ENOMEM);
}
last = sp->out_buffers;
while (last->next)
......@@ -364,6 +369,8 @@ sp_write(AVFilterContext *ctx, char *buffer, int count)
if (last->count == sizeof(last->data)) {
last->next = spb_new(ctx);
if (!last->next)
return AVERROR(ENOMEM);
last = last->next;
}
rc = read(sp->output_pipe, last->data + last->count, sizeof(last->data) - last->count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment