mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
svg: ensure that all allocated memory.
observed a memory leak at a corner case.
This commit is contained in:
parent
cf35ca3392
commit
fbcfb3f865
1 changed files with 7 additions and 1 deletions
|
@ -3528,6 +3528,10 @@ void SvgLoader::clear(bool all)
|
|||
loaderData.images.reset();
|
||||
|
||||
if (copy) free((char*)content);
|
||||
|
||||
delete(root);
|
||||
root = nullptr;
|
||||
|
||||
size = 0;
|
||||
content = nullptr;
|
||||
copy = false;
|
||||
|
@ -3751,5 +3755,7 @@ bool SvgLoader::close()
|
|||
Paint* SvgLoader::paint()
|
||||
{
|
||||
this->done();
|
||||
return root;
|
||||
auto ret = root;
|
||||
root = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue