Skip to content

Commit

Permalink
Merge pull request #68 from tellowkrinkle/FixMemoryLeaks
Browse files Browse the repository at this point in the history
Fix memory leak when compressing multiple images
  • Loading branch information
fhanau committed Dec 4, 2018
2 parents ed5dfd7 + ca1965f commit ef8c2e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/zopflipng.cpp
Expand Up @@ -525,6 +525,8 @@ static unsigned ZopfliPNGOptimize(const std::vector<unsigned char>& origpng, con
} }
std::vector<unsigned char> temp; std::vector<unsigned char> temp;
error = TryOptimize(image, imagesize, w, h, bit16, inputstate, &png_options, &temp, best_filter, filters, palette_filter); error = TryOptimize(image, imagesize, w, h, bit16, inputstate, &png_options, &temp, best_filter, filters, palette_filter);
free(image);
image = 0;
if (!error) { if (!error) {
(*resultpng).swap(temp); // Store best result so far in the output. (*resultpng).swap(temp); // Store best result so far in the output.
} }
Expand Down

0 comments on commit ef8c2e8

Please sign in to comment.