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:
JunsuChoi 2021-02-01 13:22:44 +09:00 committed by Hermet Park
parent 9b4769076f
commit 5c914f4ad2

View file

@ -1535,6 +1535,9 @@ static SvgStyleGradient* _cloneGradient(SvgStyleGradient* from)
return grad;
error_grad_alloc:
//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);
return nullptr;
}