43 lines
1.1 KiB
Diff
43 lines
1.1 KiB
Diff
|
|
From 5e0f8347cebef2b3a9f5d75ca254aabaa0bca259 Mon Sep 17 00:00:00 2001
|
|||
|
|
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|||
|
|
Date: Sun, 8 Oct 2023 10:48:25 -0700
|
|||
|
|
Subject: [PATCH] XcursorXcFileLoad: plug memory leak in error paths
|
|||
|
|
MIME-Version: 1.0
|
|||
|
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|
|||
|
|
Found by gcc analyzer:
|
|||
|
|
file.c: In function ‘XcursorXcFileLoad’:
|
|||
|
|
file.c:782:8: warning: leak of ‘fileHeader’ [CWE-401] [-Wanalyzer-malloc-leak]
|
|||
|
|
782 | if (!images)
|
|||
|
|
| ^
|
|||
|
|
|
|||
|
|
Fixes: 3b84b14 ("Initial revision")
|
|||
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|||
|
|
---
|
|||
|
|
src/file.c | 4 ++++
|
|||
|
|
1 file changed, 4 insertions(+)
|
|||
|
|
|
|||
|
|
diff --git a/src/file.c b/src/file.c
|
|||
|
|
index 0e26955..496d447 100644
|
|||
|
|
--- a/src/file.c
|
|||
|
|
+++ b/src/file.c
|
|||
|
|
@@ -780,10 +780,14 @@ XcursorXcFileLoad (XcursorFile *file,
|
|||
|
|
}
|
|||
|
|
images = XcursorImagesCreate (nimage);
|
|||
|
|
if (!images)
|
|||
|
|
+ {
|
|||
|
|
+ _XcursorFileHeaderDestroy (fileHeader);
|
|||
|
|
return 0;
|
|||
|
|
+ }
|
|||
|
|
comments = XcursorCommentsCreate (ncomment);
|
|||
|
|
if (!comments)
|
|||
|
|
{
|
|||
|
|
+ _XcursorFileHeaderDestroy (fileHeader);
|
|||
|
|
XcursorImagesDestroy (images);
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
--
|
|||
|
|
2.33.0
|
|||
|
|
|