History

lavfi: check refcount before merging.

When merging the formats around the automatically inserted convert filters, the refcount of the format lists can not be 0. Coverity does not detect it, and suspects a memory leak, because if refcount is 0 the newly allocated lists are not stored anywhere. That gives CIDs 1224282, 1224283 and 1224284. Lists with refcount 0 are used in can_merge_formats(), so the asserts can not be moved inside the merge functions.

Nicolas George committed 12 years ago

Commit 099aff51 parent 1d12df11 file · +14 −0Browse files

Unified · Split

libavfilter/avfiltergraph.c+14−0
@@ -562,6 +562,20 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) · 561 unmodified lines
562562 filter_query_formats(convert);
563563 inlink = convert->inputs[0];
564564 outlink = convert->outputs[0];
565+ av_assert0( inlink-> in_formats->refcount > 0);
566+ av_assert0( inlink->out_formats->refcount > 0);
567+ av_assert0(outlink-> in_formats->refcount > 0);
568+ av_assert0(outlink->out_formats->refcount > 0);
569+ if (outlink->type == AVMEDIA_TYPE_AUDIO) {
570+ av_assert0( inlink-> in_samplerates->refcount > 0);
571+ av_assert0( inlink->out_samplerates->refcount > 0);
572+ av_assert0(outlink-> in_samplerates->refcount > 0);
573+ av_assert0(outlink->out_samplerates->refcount > 0);
574+ av_assert0( inlink-> in_channel_layouts->refcount > 0);
575+ av_assert0( inlink->out_channel_layouts->refcount > 0);
576+ av_assert0(outlink-> in_channel_layouts->refcount > 0);
577+ av_assert0(outlink->out_channel_layouts->refcount > 0);
578+ }
565579 if (!ff_merge_formats( inlink->in_formats, inlink->out_formats, inlink->type) ||
566580 !ff_merge_formats(outlink->in_formats, outlink->out_formats, outlink->type))
567581 ret = AVERROR(ENOSYS);

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