summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-03-24 19:42:36 +0200
committerAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-04-13 11:05:59 +0300
commite29be94edbb58b3b8dab545377a710d1f73b61e0 (patch)
tree3fc896fd011046045d521bd0cbe4bcafc14c679f
parentd144a50512466766f55ce61e3884925334b08f0d (diff)
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>
-rw-r--r--modules/im/ximcp/imRmAttr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/im/ximcp/imRmAttr.c b/modules/im/ximcp/imRmAttr.c
index 7503905b..27dcbc9c 100644
--- a/modules/im/ximcp/imRmAttr.c
+++ b/modules/im/ximcp/imRmAttr.c
@@ -1433,8 +1433,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;
@@ -1480,8 +1482,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;