Fix potential memory leak when writing WebP throws (#2600)

pull/2606/head
Adrià Arrufat 2 years ago committed by GitHub
parent 0f1d8e964f
commit 7f46535cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,8 +74,11 @@ namespace dlib {
{
fout.write(reinterpret_cast<char*>(output), output_size);
if (!fout.good())
{
WebPFree(output);
throw image_save_error("Error while writing WebP image to " + filename + ".");
}
}
else
{
throw image_save_error("Error while encoding WebP image to " + filename + ".");

Loading…
Cancel
Save