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>
This commit is contained in:
Mikhail Dmitrichenko 2026-02-05 16:07:43 +03:00 committed by Mikhail
parent 36a7fdd315
commit 42eceded0f

View file

@ -914,6 +914,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
free(pPicture->pSourcePict);
free(pPicture);
return 0;
}
@ -959,6 +960,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
free(pPicture->pSourcePict);
free(pPicture);
return 0;
}
@ -997,6 +999,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
free(pPicture->pSourcePict);
free(pPicture);
return 0;
}