aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-03-25 14:47:35 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:25 +0200
commit6fe8d44ca01c56b5d639c258ad73a5d0b74fc6b8 (patch)
tree566f561a74a570c10eca11993343d8a8c6e9423e /nx-X11/lib
parent73a2898af337ea96772dfd1036d7c36e61ac5fd0 (diff)
downloadnx-libs-6fe8d44ca01c56b5d639c258ad73a5d0b74fc6b8.tar.gz
nx-libs-6fe8d44ca01c56b5d639c258ad73a5d0b74fc6b8.tar.bz2
nx-libs-6fe8d44ca01c56b5d639c258ad73a5d0b74fc6b8.zip
om: Fix memory leaks on get_font_name error paths.
While at it, remove unneeded check for NULL before Xfree. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/omGeneric.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c
index 6b5e30a69..e54b27c29 100644
--- a/nx-X11/lib/X11/omGeneric.c
+++ b/nx-X11/lib/X11/omGeneric.c
@@ -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;
}