Skip to content

Commit

Permalink
fixup memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Jun 19, 2022
1 parent 2cb5eb8 commit cd25631
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pipeline.cc
Expand Up @@ -188,8 +188,10 @@ class PipelineWorker : public Napi::AsyncWorker {
if (jpegShrinkOnLoad > 1 && static_cast<int>(shrink) == jpegShrinkOnLoad) {
jpegShrinkOnLoad /= 2;
}
} else if (inputImageType == sharp::ImageType::WEBP ||
inputImageType == sharp::ImageType::SVG ||
} else if (inputImageType == sharp::ImageType::WEBP && shrink > 1.0) {
// Avoid upscaling via webp
scale = 1.0 / shrink;
} else if (inputImageType == sharp::ImageType::SVG ||
inputImageType == sharp::ImageType::PDF) {
scale = 1.0 / shrink;
}
Expand Down Expand Up @@ -217,7 +219,7 @@ class PipelineWorker : public Napi::AsyncWorker {
->set("access", baton->input->access)
->set("scale", scale)
->set("fail_on", baton->input->failOn);
if (scale < 1.0 && inputImageType == sharp::ImageType::WEBP) {
if (inputImageType == sharp::ImageType::WEBP) {
option->set("n", baton->input->pages);
option->set("page", baton->input->page);

Expand Down

0 comments on commit cd25631

Please sign in to comment.