Permalink
Browse files

Merge pull request #68 from tellowkrinkle/FixMemoryLeaks

Fix memory leak when compressing multiple images
  • Loading branch information...
fhanau committed Dec 4, 2018
2 parents ed5dfd7 + ca1965f commit ef8c2e8a286f57bd2973a9196f991acd0b11c8e4
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/zopflipng.cpp
@@ -525,6 +525,8 @@ static unsigned ZopfliPNGOptimize(const std::vector<unsigned char>& origpng, con
}
std::vector<unsigned char> temp;
error = TryOptimize(image, imagesize, w, h, bit16, inputstate, &png_options, &temp, best_filter, filters, palette_filter);
free(image);
image = 0;
if (!error) {
(*resultpng).swap(temp); // Store best result so far in the output.
}

0 comments on commit ef8c2e8

Please sign in to comment.