History

avfilter/af_afir: Fix leak of AVFilterChannelLayout in case of error

If an error happens between the allocation of an AVFilterChannelLayout and its usage (which involves attaching said object to a more permanent object), the channel layout array leaks. This can simply be fixed by making sure that nothing is between the allocation and the aforementioned usage. Fixes Coverity issue #1250334.

Andreas Rheinhardt committed 6 years ago

Commit 3a0f0801 parent 1c7e55d1 file · +4 −4Browse files

Unified · Split

libavfilter/af_afir.c+4−4
@@ -742,14 +742,14 @@ static int query_formats(AVFilterContext *ctx) · 741 unmodified lines
742742 } else {
743743 AVFilterChannelLayouts *mono = NULL;
744744
745− ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO);
746− if (ret)
747− return ret;
748−
749745 if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts)) < 0)
750746 return ret;
751747 if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0)
752748 return ret;
749+
750+ ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO);
751+ if (ret)
752+ return ret;
753753 for (int i = 1; i < ctx->nb_inputs; i++) {
754754 if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[i]->out_channel_layouts)) < 0)
755755 return ret;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t