From: Stefano Sabatini <[email protected]>
---
libavfilter/avfilter.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f04ffce..d52a477 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -164,6 +164,31 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
return 0;
}
+static void filter_link_free(AVFilterLink **link)
+{
+ if (!*link)
+ return;
+
+ if ((*link)->pool) {
+ int i;
+ for (i = 0; i < POOL_SIZE; i++) {
+ if ((*link)->pool->pic[i]) {
+ AVFilterBufferRef *picref = (*link)->pool->pic[i];
+ /* free buffer: picrefs stored in the pool are not
+ * supposed to contain a free callback */
+ av_freep(&picref->buf->data[0]);
+ av_freep(&picref->buf);
+
+ av_freep(&picref->audio);
+ av_freep(&picref->video);
+ av_freep(&picref);
+ }
+ }
+ av_freep(&(*link)->pool);
+ }
+ av_freep(link);
+}
+
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
{
@@ -684,7 +709,7 @@ void avfilter_free(AVFilterContext *filter)
avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&link->out_formats);
}
- av_freep(&link);
+ filter_link_free(&link);
}
for (i = 0; i < filter->output_count; i++) {
if ((link = filter->outputs[i])) {
@@ -693,7 +718,7 @@ void avfilter_free(AVFilterContext *filter)
avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&link->out_formats);
}
- av_freep(&link);
+ filter_link_free(&link);
}
av_freep(&filter->name);
--
1.7.5.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel