mirror of https://github.com/davisking/dlib.git
Fix potential memory leak when writing WebP throws (#2600)
This commit is contained in:
parent
0f1d8e964f
commit
7f46535cce
|
@ -74,7 +74,10 @@ 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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue