From 838108c296cb739350456f49431b57821c78b15c Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Wed, 8 May 2013 19:33:09 +0200 Subject: XListFontsWithInfo: Re-decrement flist[0] before calling free() on it. Freeing a pointer that wasn't returned by malloc() is undefined behavior and produces an error with OpenBSD's implementation. Signed-off-by: Matthieu Herrb Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith Signed-off-by: Julien Cristau Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/FontInfo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/X11/FontInfo.c b/nx-X11/lib/X11/FontInfo.c index 4b295a5eb..0cb5b1910 100644 --- a/nx-X11/lib/X11/FontInfo.c +++ b/nx-X11/lib/X11/FontInfo.c @@ -174,8 +174,10 @@ XFontStruct **info) /* RETURN */ badmem: /* Free all memory allocated by this function. */ for (j=(i-1); (j >= 0); j--) { - Xfree(flist[j]); - if (finfo[j].properties) Xfree((char *) finfo[j].properties); + if (j == 0) + flist[j]--; /* was incremented above */ + Xfree(flist[j]); + if (finfo[j].properties) Xfree((char *) finfo[j].properties); } if (flist) Xfree((char *) flist); if (finfo) Xfree((char *) finfo); -- cgit v1.2.3