aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-12-03 23:19:48 -0800
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commit8d6d95d74c0e0e6fcd3523c78ad7b9607288f578 (patch)
treed270047a843a663446c221e5e999586681658faf
parent8339e680375bec533005bc5a2e8e01d3ec5a3fe6 (diff)
downloadnx-libs-8d6d95d74c0e0e6fcd3523c78ad7b9607288f578.tar.gz
nx-libs-8d6d95d74c0e0e6fcd3523c78ad7b9607288f578.tar.bz2
nx-libs-8d6d95d74c0e0e6fcd3523c78ad7b9607288f578.zip
Bug 93184: read_EncodingInfo invalid free
Free the correct bits of memory if we run out and need to unwind Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93184 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r--nx-X11/lib/X11/omGeneric.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c
index 143ec00eb..31575d85d 100644
--- a/nx-X11/lib/X11/omGeneric.c
+++ b/nx-X11/lib/X11/omGeneric.c
@@ -1877,13 +1877,13 @@ read_EncodingInfo(
{
FontData font_data,ret;
char *buf, *bufptr,*scp;
- int len;
+ int len, i;
font_data = Xcalloc(count, sizeof(FontDataRec));
if (font_data == NULL)
return NULL;
ret = font_data;
- for ( ; count-- > 0; font_data++) {
+ for (i = 0; i < count; i++, font_data++) {
/*
strcpy(buf, *value++);
*/
@@ -1895,7 +1895,8 @@ read_EncodingInfo(
len = strlen(buf);
font_data->name = Xmalloc(len + 1);
if (font_data->name == NULL) {
- Xfree(font_data);
+ free_fontdataOM(ret, i + 1);
+ Xfree(ret);
return NULL;
}
strncpy(font_data->name, buf,len);