Commit 838108c2 authored by Matthieu Herrb's avatar Matthieu Herrb Committed by Ulrich Sibiller

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: 's avatarMatthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: 's avatarJulien Cristau <jcristau@debian.org> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent dc749a45
......@@ -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);
......
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