[PATCH 05/16] Fix memory leak on _XimGetAttributeID error path.

Ander Conselvan de Oliveira ander.conselvan-de-oliveira at nokia.com
Wed Mar 30 06:11:58 PDT 2011


Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
---
 modules/im/ximcp/imRmAttr.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/im/ximcp/imRmAttr.c b/modules/im/ximcp/imRmAttr.c
index 5035df5..0471f3d 100644
--- a/modules/im/ximcp/imRmAttr.c
+++ b/modules/im/ximcp/imRmAttr.c
@@ -1480,8 +1480,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;
-- 
1.7.0.4



More information about the xorg-devel mailing list