mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcursor.git
synced 2026-05-05 21:38:07 +02:00
XcursorFileSaveImages: plug memory leak on invalid input
Error: Memory leak (CWE 401)
Memory leak of pointer 'comments' allocated with XcursorCommentsCreate(0)
at line 982 of src/file.c in function 'XcursorFileSaveImages'.
'comments' allocated at line 978 with XcursorCommentsCreate(0).
comments leaks when comments != 0 at line 981.
[ This bug was found by the Parfait 0.3.7 bug checking tool.
For more information see http://labs.oracle.com/projects/parfait/ ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
bcfb8e8ce5
commit
2b8d373bdd
1 changed files with 5 additions and 2 deletions
|
|
@ -975,10 +975,13 @@ XcursorFileLoad (FILE *file,
|
|||
XcursorBool
|
||||
XcursorFileSaveImages (FILE *file, const XcursorImages *images)
|
||||
{
|
||||
XcursorComments *comments = XcursorCommentsCreate (0);
|
||||
XcursorComments *comments;
|
||||
XcursorFile f;
|
||||
XcursorBool ret;
|
||||
if (!comments || !file || !images)
|
||||
|
||||
if (!file || !images)
|
||||
return 0;
|
||||
if ((comments = XcursorCommentsCreate (0)) == NULL)
|
||||
return 0;
|
||||
_XcursorStdioFileInitialize (file, &f);
|
||||
ret = XcursorXcFileSave (&f, comments, images) && fflush (file) != EOF;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue