|
|
@@ -170,13 +170,18 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
static void free_inout(AVFilterInOut *head) |
|
|
|
AVFilterInOut *avfilter_inout_alloc(void) |
|
|
|
{ |
|
|
|
while (head) { |
|
|
|
AVFilterInOut *next = head->next; |
|
|
|
av_free(head->name); |
|
|
|
av_free(head); |
|
|
|
head = next; |
|
|
|
return av_mallocz(sizeof(AVFilterInOut)); |
|
|
|
} |
|
|
|
|
|
|
|
void avfilter_inout_free(AVFilterInOut **inout) |
|
|
|
{ |
|
|
|
while (*inout) { |
|
|
|
AVFilterInOut *next = (*inout)->next; |
|
|
|
av_freep(&(*inout)->name); |
|
|
|
av_freep(inout); |
|
|
|
*inout = next; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -431,9 +436,9 @@ int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, |
|
|
|
for (; graph->filter_count > 0; graph->filter_count--) |
|
|
|
avfilter_free(graph->filters[graph->filter_count - 1]); |
|
|
|
av_freep(&graph->filters); |
|
|
|
free_inout(open_inputs); |
|
|
|
free_inout(open_outputs); |
|
|
|
free_inout(curr_inputs); |
|
|
|
avfilter_inout_free(&open_inputs); |
|
|
|
avfilter_inout_free(&open_outputs); |
|
|
|
avfilter_inout_free(&curr_inputs); |
|
|
|
|
|
|
|
*inputs = NULL; |
|
|
|
*outputs = NULL; |
|
|
@@ -467,7 +472,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, |
|
|
|
continue; |
|
|
|
ret = avfilter_link(match->filter_ctx, match->pad_idx, |
|
|
|
cur->filter_ctx, cur->pad_idx); |
|
|
|
free_inout(match); |
|
|
|
avfilter_inout_free(&match); |
|
|
|
if (ret < 0) |
|
|
|
goto fail; |
|
|
|
} |
|
|
@@ -487,7 +492,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, |
|
|
|
continue; |
|
|
|
ret = avfilter_link(cur->filter_ctx, cur->pad_idx, |
|
|
|
match->filter_ctx, match->pad_idx); |
|
|
|
free_inout(match); |
|
|
|
avfilter_inout_free(&match); |
|
|
|
if (ret < 0) |
|
|
|
goto fail; |
|
|
|
} |
|
|
@@ -498,9 +503,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, |
|
|
|
avfilter_free(graph->filters[graph->filter_count - 1]); |
|
|
|
av_freep(&graph->filters); |
|
|
|
} |
|
|
|
free_inout(inputs); |
|
|
|
free_inout(outputs); |
|
|
|
free_inout(open_inputs); |
|
|
|
free_inout(open_outputs); |
|
|
|
avfilter_inout_free(&inputs); |
|
|
|
avfilter_inout_free(&outputs); |
|
|
|
avfilter_inout_free(&open_inputs); |
|
|
|
avfilter_inout_free(&open_outputs); |
|
|
|
return ret; |
|
|
|
} |