From 80a977f07e6c4f5e1612b37441dbfa41c5b72bde Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Mon, 30 Sep 2024 12:28:00 +0200 Subject: [PATCH] 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 --- src/loaders/lottie/tvgLottieParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/loaders/lottie/tvgLottieParser.cpp b/src/loaders/lottie/tvgLottieParser.cpp index 468934f8..2fcc52c8 100644 --- a/src/loaders/lottie/tvgLottieParser.cpp +++ b/src/loaders/lottie/tvgLottieParser.cpp @@ -254,7 +254,8 @@ void LottieParser::getValue(ColorStop& color) { if (peekType() == kArrayType) enterArray(); - color.input = new Array(static_cast(context.parent)->colorStops.count); + if (!color.input) color.input = new Array(static_cast(context.parent)->colorStops.count); + else color.input->clear(); while (nextArrayValue()) color.input->push(getFloat()); }