aboutsummaryrefslogtreecommitdiff
path: root/libX11/modules/om/generic/omGeneric.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-15 14:48:46 +0000
committermarha <marha@users.sourceforge.net>2011-04-15 14:48:46 +0000
commit71372d36e1a3f0230b88808f70d35446fda12260 (patch)
tree205982f029074be1167820e69891d8332e0a8df2 /libX11/modules/om/generic/omGeneric.c
parent019fc27ce6dc2a1809107be10d4deb80e0fa436b (diff)
downloadvcxsrv-71372d36e1a3f0230b88808f70d35446fda12260.tar.gz
vcxsrv-71372d36e1a3f0230b88808f70d35446fda12260.tar.bz2
vcxsrv-71372d36e1a3f0230b88808f70d35446fda12260.zip
xserver xkeyboard-config libX11 mesa git update 15 April 2011
Diffstat (limited to 'libX11/modules/om/generic/omGeneric.c')
-rw-r--r--libX11/modules/om/generic/omGeneric.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/libX11/modules/om/generic/omGeneric.c b/libX11/modules/om/generic/omGeneric.c
index c78c0a9d6..44143ac2e 100644
--- a/libX11/modules/om/generic/omGeneric.c
+++ b/libX11/modules/om/generic/omGeneric.c
@@ -575,7 +575,7 @@ get_rotate_fontname(
}
if(field_num < CHARSET_ENCODING_FIELD)
- return NULL;
+ goto free_pattern;
/* Pixel Size field : fields[6] */
for(ptr = fields[PIXEL_SIZE_FIELD - 1] ; ptr && *ptr; ptr++) {
@@ -584,9 +584,7 @@ get_rotate_fontname(
strcpy(pattern, font_name);
return(pattern);
}
- if(pattern)
- Xfree(pattern);
- return NULL;
+ goto free_pattern;
}
}
pixel_size = atoi(fields[PIXEL_SIZE_FIELD - 1]);
@@ -605,11 +603,11 @@ get_rotate_fontname(
/* Max XLFD length is 255 */
if (len > XLFD_MAX_LEN)
- return NULL;
+ goto free_pattern;
rotate_font_ptr = (char *)Xmalloc(len + 1);
if(!rotate_font_ptr)
- return NULL;
+ goto free_pattern;
rotate_font_ptr[0] = '\0';
@@ -619,8 +617,8 @@ get_rotate_fontname(
strcat(rotate_font_ptr, fields[field_num]);
}
- if(pattern)
- Xfree(pattern);
+free_pattern:
+ Xfree(pattern);
return rotate_font_ptr;
}
@@ -1932,8 +1930,10 @@ read_EncodingInfo(
} else
len = strlen(buf);
font_data->name = (char *) Xmalloc(len + 1);
- if (font_data->name == NULL)
+ if (font_data->name == NULL) {
+ Xfree(font_data);
return NULL;
+ }
strncpy(font_data->name, buf,len);
font_data->name[len] = 0;
if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0)
@@ -2117,22 +2117,24 @@ init_om(
if (required_list == NULL)
return False;
- bufptr = (char *) Xmalloc(length);
- if (bufptr == NULL) {
- Xfree(required_list);
- return False;
- }
-
om->core.required_charset.charset_list = required_list;
om->core.required_charset.charset_count = gen->data_num;
count = gen->data_num;
data = gen->data;
- for ( ; count-- > 0; data++) {
- strcpy(bufptr, data->font_data->name);
- *required_list++ = bufptr;
- bufptr += strlen(bufptr) + 1;
+ if (count > 0) {
+ bufptr = (char *) Xmalloc(length);
+ if (bufptr == NULL) {
+ Xfree(required_list);
+ return False;
+ }
+
+ for ( ; count-- > 0; data++) {
+ strcpy(bufptr, data->font_data->name);
+ *required_list++ = bufptr;
+ bufptr += strlen(bufptr) + 1;
+ }
}
/* orientation list */