mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +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();
|
loaderData.images.reset();
|
||||||
|
|
||||||
if (copy) free((char*)content);
|
if (copy) free((char*)content);
|
||||||
|
|
||||||
|
delete(root);
|
||||||
|
root = nullptr;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
content = nullptr;
|
content = nullptr;
|
||||||
copy = false;
|
copy = false;
|
||||||
|
@ -3751,5 +3755,7 @@ bool SvgLoader::close()
|
||||||
Paint* SvgLoader::paint()
|
Paint* SvgLoader::paint()
|
||||||
{
|
{
|
||||||
this->done();
|
this->done();
|
||||||
return root;
|
auto ret = root;
|
||||||
|
root = nullptr;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue