mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Fix potential memory leak when writing WebP throws (#2600)
This commit is contained in:
parent
0f1d8e964f
commit
7f46535cce
@ -74,8 +74,11 @@ namespace dlib {
|
|||||||
{
|
{
|
||||||
fout.write(reinterpret_cast<char*>(output), output_size);
|
fout.write(reinterpret_cast<char*>(output), output_size);
|
||||||
if (!fout.good())
|
if (!fout.good())
|
||||||
|
{
|
||||||
|
WebPFree(output);
|
||||||
throw image_save_error("Error while writing WebP image to " + filename + ".");
|
throw image_save_error("Error while writing WebP image to " + filename + ".");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw image_save_error("Error while encoding WebP image to " + filename + ".");
|
throw image_save_error("Error while encoding WebP image to " + filename + ".");
|
||||||
|
Loading…
Reference in New Issue
Block a user