lottie: fix mem leak

Mem leak was observed in a case the end values
(deprecated feature) were provided for the gradient.

@Issue: https://github.com/thorvg/thorvg/issues/2667
This commit is contained in:
Mira Grudzinska 2024-09-30 12:28:00 +02:00 committed by Hermet Park
parent fa9223fe1e
commit 80a977f07e

View file

@ -254,7 +254,8 @@ void LottieParser::getValue(ColorStop& color)
{ {
if (peekType() == kArrayType) enterArray(); if (peekType() == kArrayType) enterArray();
color.input = new Array<float>(static_cast<LottieGradient*>(context.parent)->colorStops.count); if (!color.input) color.input = new Array<float>(static_cast<LottieGradient*>(context.parent)->colorStops.count);
else color.input->clear();
while (nextArrayValue()) color.input->push(getFloat()); while (nextArrayValue()) color.input->push(getFloat());
} }