aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-10-07 12:31:46 +0200
committerAnton Khirnov <anton@khirnov.net>2024-10-10 09:09:29 +0200
commit84c2ca6fa07e5507092ffaffb47f4a0d88a7b88c (patch)
treed98bb8faa3164578d939543db46eb5687ecd8ff1
parent181c20414538e0c829605241c64b0a873baa5f97 (diff)
downloadffmpeg-84c2ca6fa07e5507092ffaffb47f4a0d88a7b88c.tar.gz
fftools/ffmpeg_filter: do not leak graph_desc on fg_create() failure
fg_create() is passed a malloced string and assumed to always take ownership of it.
-rw-r--r--fftools/ffmpeg_filter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index faab003e71..4d444c161f 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1058,8 +1058,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
int ret = 0;
fgp = av_mallocz(sizeof(*fgp));
- if (!fgp)
+ if (!fgp) {
+ av_freep(&graph_desc);
return AVERROR(ENOMEM);
+ }
fg = &fgp->fg;
if (pfg) {
@@ -1068,6 +1070,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
} else {
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
if (ret < 0) {
+ av_freep(&graph_desc);
av_freep(&fgp);
return ret;
}