xorg-x11-server-Xwayland/0019-render-fix-multiple-mem-leaks-on-err-paths.patch
2026-06-16 09:59:01 +02:00

50 lines
1.7 KiB
Diff

From b7ba6b5c61e9ee799881db8d5901311bc1a69013 Mon Sep 17 00:00:00 2001
From: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Date: Thu, 5 Feb 2026 16:07:43 +0300
Subject: [PATCH xserver 19/31] 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 <m.dmitrichenko222@gmail.com>
(cherry picked from commit 809402414e4b84ad5c084221c7b4da9bd2c5d55d)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
---
render/picture.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/render/picture.c b/render/picture.c
index 6cc3e7e4c..b2ceed55e 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -913,6 +913,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
+ free(pPicture->pSourcePict);
free(pPicture);
return 0;
}
@@ -958,6 +959,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
+ free(pPicture->pSourcePict);
free(pPicture);
return 0;
}
@@ -996,6 +998,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
+ free(pPicture->pSourcePict);
free(pPicture);
return 0;
}
--
2.54.0