diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-10-08 10:48:25 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-10-08 10:48:25 -0700 |
commit | 5e0f8347cebef2b3a9f5d75ca254aabaa0bca259 (patch) | |
tree | ebb30bc06c5ee1c0ad60b243cf2d083da2b2a1dc /src | |
parent | 9c1b50ed98d354488329c99bc8bf77d1c6df657c (diff) |
XcursorXcFileLoad: plug memory leak in error paths
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; } |