Commit 748cf894 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Ulrich Sibiller

om: Fix potential memory leak in init_om.

parent 6fe8d44c
...@@ -2094,22 +2094,24 @@ init_om( ...@@ -2094,22 +2094,24 @@ init_om(
if (required_list == NULL) if (required_list == NULL)
return False; 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_list = required_list;
om->core.required_charset.charset_count = gen->data_num; om->core.required_charset.charset_count = gen->data_num;
count = gen->data_num; count = gen->data_num;
data = gen->data; data = gen->data;
for ( ; count-- > 0; data++) { if (count > 0) {
strcpy(bufptr, data->font_data->name); bufptr = (char *) Xmalloc(length);
*required_list++ = bufptr; if (bufptr == NULL) {
bufptr += strlen(bufptr) + 1; Xfree(required_list);
return False;
}
for ( ; count-- > 0; data++) {
strcpy(bufptr, data->font_data->name);
*required_list++ = bufptr;
bufptr += strlen(bufptr) + 1;
}
} }
/* orientation list */ /* orientation list */
......
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