[PATCH] xf86OutputRename: Replace another strlen/malloc/strcpy set with strdup
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Nov 26 17:32:00 PST 2010
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
hw/xfree86/modes/xf86Crtc.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7fc2a60..ae5aad3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -660,13 +660,11 @@ xf86OutputCreate (ScrnInfoPtr scrn,
Bool
xf86OutputRename (xf86OutputPtr output, const char *name)
{
- int len = strlen(name) + 1;
- char *newname = malloc(len);
+ char *newname = strdup(name);
if (!newname)
return FALSE; /* so sorry... */
- strcpy (newname, name);
if (output->name && output->name != (char *) (output + 1))
free(output->name);
output->name = newname;
--
1.7.3.2
More information about the xorg-devel
mailing list