@ -170,13 +170,18 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr
return ret ;
}
static void free_inout ( AVFilterInOut * hea d)
AVFilterInOut * avfilter_inout_alloc ( voi d)
{
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 ) ;
av filte r_inout_free ( & open_inputs ) ;
av filte r_inout_free ( & open_outputs ) ;
av filte r_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 ) ;
av filte r_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 ) ;
av filte r_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 ) ;
av filte r_inout_free ( & inputs ) ;
av filte r_inout_free ( & outputs ) ;
av filte r_inout_free ( & open_inputs ) ;
av filte r_inout_free ( & open_outputs ) ;
return ret ;
}