aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-03-24 19:42:36 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:25 +0200
commit369c956683108226a30bbdd55355f0d8ae57eeb4 (patch)
tree5b9c0e3923d1a0ad8fb5724dd012f9c6b8c232c8
parentf50e651e8acd28f3798d31038b6b9804b8309a89 (diff)
downloadnx-libs-369c956683108226a30bbdd55355f0d8ae57eeb4.tar.gz
nx-libs-369c956683108226a30bbdd55355f0d8ae57eeb4.tar.bz2
nx-libs-369c956683108226a30bbdd55355f0d8ae57eeb4.zip
Fix memory leaks on _XimGetAttributeID error paths.
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>
-rw-r--r--nx-X11/lib/X11/imRmAttr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nx-X11/lib/X11/imRmAttr.c b/nx-X11/lib/X11/imRmAttr.c
index b6d1e1293..975a1edcd 100644
--- a/nx-X11/lib/X11/imRmAttr.c
+++ b/nx-X11/lib/X11/imRmAttr.c
@@ -1430,8 +1430,10 @@ _XimGetAttributeID(
bzero((char *)res, res_len);
values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
- if (!(tmp = (XPointer)Xmalloc(values_len)))
+ if (!(tmp = (XPointer)Xmalloc(values_len))) {
+ Xfree(res);
return False;
+ }
bzero(tmp, values_len);
values_list = (XIMValuesList *)tmp;
@@ -1477,8 +1479,10 @@ _XimGetAttributeID(
bzero((char *)res, res_len);
values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
- if (!(tmp = (XPointer)Xmalloc(values_len)))
+ if (!(tmp = (XPointer)Xmalloc(values_len))) {
+ Xfree(res);
return False;
+ }
bzero(tmp, values_len);
values_list = (XIMValuesList *)tmp;