Skip to content

Commit

Permalink
Fix memory leak when MiscFilters not found
Browse files Browse the repository at this point in the history
  • Loading branch information
HolyWu committed Oct 10, 2021
1 parent f900812 commit 4577fe6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TTempSmooth/TTempSmooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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));
Expand Down

0 comments on commit 4577fe6

Please sign in to comment.