common: ++exception handling.

fix the memory leak in the corner case

detected by tvg test suites

@Issue: https://github.com/Samsung/thorvg/issues/995
This commit is contained in:
Hermet Park 2021-11-05 21:04:51 +09:00 committed by Hermet Park
parent 00bba39b02
commit 37e39866dd

View file

@ -110,9 +110,12 @@ Result Saver::save(std::unique_ptr<Paint> paint, const string& path, bool compre
pImpl->saveModule = saveModule; pImpl->saveModule = saveModule;
return Result::Success; return Result::Success;
} else { } else {
delete(p);
delete(saveModule);
return Result::Unknown; return Result::Unknown;
} }
} }
delete(p);
return Result::NonSupport; return Result::NonSupport;
} }