[PATCH:libX11 1/7] Use strdup instead of Xmalloc+strcpy in _XDefaultOpenIM

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jan 1 18:14:56 PST 2016


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/xlibi18n/XDefaultIMIF.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xlibi18n/XDefaultIMIF.c b/src/xlibi18n/XDefaultIMIF.c
index 4e75fa0..7c32ce2 100644
--- a/src/xlibi18n/XDefaultIMIF.c
+++ b/src/xlibi18n/XDefaultIMIF.c
@@ -202,9 +202,8 @@ _XDefaultOpenIM(
 	}
     }
 #undef MODIFIER
-    if ((im->core.im_name = Xmalloc(i+1)) == NULL)
+    if ((im->core.im_name = strdup(buf)) == NULL)
 	goto Error;
-    strcpy(im->core.im_name, buf);
 
     im->methods        = (XIMMethods)&local_im_methods;
     im->core.lcd       = lcd;
-- 
2.6.1



More information about the xorg-devel mailing list