From e14489988338c648897b23197efaceffbfaa20d2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 18 May 2015 07:55:17 +1000 Subject: 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 Reviewed-by: Hans de Goede Reviewed-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imLcPrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/lib/X11') 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) -- cgit v1.2.3