mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
svg_loader SvgLoader: Prevent memory leak
When OOM of SvgLinear/RadialGradient occurs, the allocated id, ref, transform may become a memory leak. Therefore, add free memory.
This commit is contained in:
parent
9b4769076f
commit
5c914f4ad2
1 changed files with 3 additions and 0 deletions
|
@ -1535,6 +1535,9 @@ static SvgStyleGradient* _cloneGradient(SvgStyleGradient* from)
|
||||||
return grad;
|
return grad;
|
||||||
error_grad_alloc:
|
error_grad_alloc:
|
||||||
//LOG: allocation failed. out of memory
|
//LOG: allocation failed. out of memory
|
||||||
|
if (grad->transform) free(grad->transform);
|
||||||
|
if (grad->ref) delete grad->ref;
|
||||||
|
if (grad->id) delete grad->id;
|
||||||
if (grad) free(grad);
|
if (grad) free(grad);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue