Commit e1448998 authored by Peter Hutterer's avatar Peter Hutterer Committed by Ulrich Sibiller

Fix potential memory leak

If we hit the depth limit, filename leaks. Move the depth check up before we allocate filename. Introduced in 226622349a4b1e16064649d4444a34fb4be4f464. Signed-off-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net> Reviewed-by: 's avatarHans de Goede <hdegoede@redhat.com> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 8e3e7bb7
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment