From 4eeb22c8bef9ec323b3c716bbfb4551014f8489e Mon Sep 17 00:00:00 2001 From: Mikhail Dmitrichenko Date: Sat, 14 Mar 2026 18:52:13 +0200 Subject: [PATCH] render: fix multiple mem leaks on err paths Free nested allocations when initialization fails. Several code paths returned early on error without releasing memory owned by embedded structures, leading to leaks. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Mikhail Dmitrichenko Part-of: --- render/picture.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/render/picture.c b/render/picture.c index 464955721c..594f02b07c 100644 --- a/render/picture.c +++ b/render/picture.c @@ -902,6 +902,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2, initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { + free(pPicture->pSourcePict); free(pPicture); return 0; } @@ -947,6 +948,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner, initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { + free(pPicture->pSourcePict); free(pPicture); return 0; } @@ -985,6 +987,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle, initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { + free(pPicture->pSourcePict); free(pPicture); return 0; }