mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-07 20:18:03 +02:00
Fix potential memory leak
If we hit the depth limit, filename leaks. Move the depth check up before we
allocate filename.
Introduced in 226622349a.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
d3415d1f05
commit
013ccece12
1 changed files with 2 additions and 2 deletions
|
|
@ -496,10 +496,10 @@ parseline(
|
|||
token = nexttoken(fp, tokenbuf, &lastch);
|
||||
if (token != KEY && token != STRING)
|
||||
goto error;
|
||||
if ((filename = TransFileName(im, tokenbuf)) == NULL)
|
||||
goto error;
|
||||
if (++depth > 100)
|
||||
goto error;
|
||||
if ((filename = TransFileName(im, tokenbuf)) == NULL)
|
||||
goto error;
|
||||
infp = _XFopenFile(filename, "r");
|
||||
Xfree(filename);
|
||||
if (infp == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue