History

Fix leak in avfilter_graph_add_filter().

In case of reallocation failure the pointer to the original filter array was lost. The correct behavior seems to just keep the old array and count. Originally committed as revision 22905 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini committed 16 years ago

Commit 3748b2b1 parent fc8fa001 file · +5 −5Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 1 file). Show all

Unified · Split

libavfilter/avfiltergraph.c+5−5
@@ -36,13 +36,13 @@ void avfilter_graph_destroy(AVFilterGraph *graph) · 35 unmodified lines
36 36
37int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)37int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
38{38{
39 graph->filters = av_realloc(graph->filters,39 AVFilterContext **filters = av_realloc(graph->filters,
40 sizeof(AVFilterContext*) * ++graph->filter_count);40 sizeof(AVFilterContext*) * (graph->filter_count+1));
41 41 if (!filters)
42 if (!graph->filters)
43 return AVERROR(ENOMEM);42 return AVERROR(ENOMEM);
44 43
45 graph->filters[graph->filter_count - 1] = filter;44 graph->filters = filters;
45 graph->filters[graph->filter_count++] = filter;
46 46
47 return 0;47 return 0;
48}48}

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