mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 01:34:11 +00:00
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> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2125>
This commit is contained in:
committed by
Enrico Weigelt
parent
0f5c85f51b
commit
4eeb22c8be
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user