[PATCH v2 12/25] [libx11] Instead of copying the value returned by get_prop_name and then releasing it, directly use the return value of get_prop_name, which allocates memory for the name.

Erkki Seppälä erkki.seppala at vincit.fi
Mon Jan 31 04:02:04 PST 2011


Variable "prop_name" not freed or pointed-to in function "strlen"

Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
 src/xlibi18n/XDefaultOMIF.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/xlibi18n/XDefaultOMIF.c b/src/xlibi18n/XDefaultOMIF.c
index bb3986a..f4f141c 100644
--- a/src/xlibi18n/XDefaultOMIF.c
+++ b/src/xlibi18n/XDefaultOMIF.c
@@ -403,9 +403,7 @@ get_font_name(
 	    return NULL;
         }
 
-	name = (char*) Xmalloc(strlen(prop_name) + 1);
-	if (name)
-	    strcpy(name, prop_name);
+	name = prop_name;
 
 	XFreeFont(dpy, fs);
     }
-- 
1.7.0.4



More information about the xorg-devel mailing list