From 4577fe65812cd04f68f0a2a5b98b91f1b6f43781 Mon Sep 17 00:00:00 2001 From: HolyWu Date: Sun, 10 Oct 2021 14:05:19 +0800 Subject: [PATCH] Fix memory leak when MiscFilters not found --- TTempSmooth/TTempSmooth.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TTempSmooth/TTempSmooth.cpp b/TTempSmooth/TTempSmooth.cpp index f4b5d24..516e13d 100644 --- a/TTempSmooth/TTempSmooth.cpp +++ b/TTempSmooth/TTempSmooth.cpp @@ -550,6 +550,10 @@ static void VS_CC ttempsmoothCreate(const VSMap* in, VSMap* out, [[maybe_unused] } if (d->scthresh) { + auto miscPlugin{ vsapi->getPluginByID("com.vapoursynth.misc", core) }; + if (!miscPlugin) + throw "MiscFilters (https://github.com/vapoursynth/vs-miscfilters-obsolete) not installed"; + auto args{ vsapi->createMap() }; if (d->vi->format.colorFamily == cfRGB) { @@ -575,10 +579,6 @@ static void VS_CC ttempsmoothCreate(const VSMap* in, VSMap* out, [[maybe_unused] } vsapi->mapSetFloat(args, "threshold", d->scthresh / 100.0, maReplace); - auto miscPlugin{ vsapi->getPluginByID("com.vapoursynth.misc", core) }; - if (!miscPlugin) - throw "MiscFilters (https://github.com/vapoursynth/vs-miscfilters-obsolete) not installed"; - auto ret{ vsapi->invoke(miscPlugin, "SCDetect", args) }; if (vsapi->mapGetError(ret)) { vsapi->mapSetError(out, vsapi->mapGetError(ret));