aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2013-05-08 19:33:09 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-12 09:34:39 +0200
commit838108c296cb739350456f49431b57821c78b15c (patch)
tree2f6dbf0623c30806fda847c23646a3b396e62356 /nx-X11/lib
parentdc749a457d62b330051e9fb709960951e05de41b (diff)
downloadnx-libs-838108c296cb739350456f49431b57821c78b15c.tar.gz
nx-libs-838108c296cb739350456f49431b57821c78b15c.tar.bz2
nx-libs-838108c296cb739350456f49431b57821c78b15c.zip
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 <matthieu.herrb@laas.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Julien Cristau <jcristau@debian.org> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/FontInfo.c6
1 files changed, 4 insertions, 2 deletions
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);