From 4c1d0dae9139bd7247e8b285f11458901ca38138 Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Thu, 15 Aug 2024 05:54:33 +0000 Subject: [PATCH] Plug memory leak when printing filter graph. --- ffmpeg/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg/filter.c b/ffmpeg/filter.c index 9bacc1ec46..7d9914c1e6 100644 --- a/ffmpeg/filter.c +++ b/ffmpeg/filter.c @@ -112,8 +112,12 @@ int init_video_filters(struct input_ctx *ictx, struct output_ctx *octx) ret = avfilter_graph_config(vf->graph, NULL); if (ret < 0) LPMS_ERR(vf_init_cleanup, "Unable configure video filtergraph"); + char *dumped_graph = avfilter_graph_dump(vf->graph, NULL); LPMS_DEBUG("Initialized filtergraph: "); - LPMS_DEBUG(avfilter_graph_dump(vf->graph, NULL)); + if (dumped_graph) { + LPMS_DEBUG(dumped_graph); + av_freep(&dumped_graph); + } vf->frame = av_frame_alloc(); if (!vf->frame) LPMS_ERR(vf_init_cleanup, "Unable to allocate video frame");