Commit 8d6d95d7 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

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=93184Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 8339e680
...@@ -1877,13 +1877,13 @@ read_EncodingInfo( ...@@ -1877,13 +1877,13 @@ read_EncodingInfo(
{ {
FontData font_data,ret; FontData font_data,ret;
char *buf, *bufptr,*scp; char *buf, *bufptr,*scp;
int len; int len, i;
font_data = Xcalloc(count, sizeof(FontDataRec)); font_data = Xcalloc(count, sizeof(FontDataRec));
if (font_data == NULL) if (font_data == NULL)
return NULL; return NULL;
ret = font_data; ret = font_data;
for ( ; count-- > 0; font_data++) { for (i = 0; i < count; i++, font_data++) {
/* /*
strcpy(buf, *value++); strcpy(buf, *value++);
*/ */
...@@ -1895,7 +1895,8 @@ read_EncodingInfo( ...@@ -1895,7 +1895,8 @@ read_EncodingInfo(
len = strlen(buf); len = strlen(buf);
font_data->name = Xmalloc(len + 1); font_data->name = Xmalloc(len + 1);
if (font_data->name == NULL) { if (font_data->name == NULL) {
Xfree(font_data); free_fontdataOM(ret, i + 1);
Xfree(ret);
return NULL; return NULL;
} }
strncpy(font_data->name, buf,len); strncpy(font_data->name, buf,len);
......
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