mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-31 11:10:50 +02: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>
(cherry picked from commit 809402414e)
This commit is contained in:
parent
0a9b3b037e
commit
42a81067c7
1 changed files with 3 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue