Commit 6fe8d44c authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Ulrich Sibiller

om: Fix memory leaks on get_font_name error paths.

While at it, remove unneeded check for NULL before Xfree. Signed-off-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 73a2898a
......@@ -572,7 +572,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++) {
......@@ -581,9 +581,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]);
......@@ -602,11 +600,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';
......@@ -616,8 +614,8 @@ get_rotate_fontname(
strcat(rotate_font_ptr, fields[field_num]);
}
if(pattern)
Xfree(pattern);
free_pattern:
Xfree(pattern);
return rotate_font_ptr;
}
......
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