aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/imLcPrs.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-05-18 07:55:17 +1000
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commite14489988338c648897b23197efaceffbfaa20d2 (patch)
treeb97834b39d2d51ecafc67c7e83a7215c160e810f /nx-X11/lib/X11/imLcPrs.c
parent8e3e7bb774beac484c3c74b9f46597a5debad219 (diff)
downloadnx-libs-e14489988338c648897b23197efaceffbfaa20d2.tar.gz
nx-libs-e14489988338c648897b23197efaceffbfaa20d2.tar.bz2
nx-libs-e14489988338c648897b23197efaceffbfaa20d2.zip
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: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/imLcPrs.c')
-rw-r--r--nx-X11/lib/X11/imLcPrs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nx-X11/lib/X11/imLcPrs.c b/nx-X11/lib/X11/imLcPrs.c
index 7528d838f..fa992e5d3 100644
--- a/nx-X11/lib/X11/imLcPrs.c
+++ b/nx-X11/lib/X11/imLcPrs.c
@@ -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)