xf86OutputRename: Replace another strlen/malloc/strcpy set with strdup

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Alan Coopersmith 2010-11-26 16:53:40 -08:00
parent d346bc3083
commit 29e467a1f1

View File

@ -660,13 +660,11 @@ xf86OutputCreate (ScrnInfoPtr scrn,
Bool Bool
xf86OutputRename (xf86OutputPtr output, const char *name) xf86OutputRename (xf86OutputPtr output, const char *name)
{ {
int len = strlen(name) + 1; char *newname = strdup(name);
char *newname = malloc(len);
if (!newname) if (!newname)
return FALSE; /* so sorry... */ return FALSE; /* so sorry... */
strcpy (newname, name);
if (output->name && output->name != (char *) (output + 1)) if (output->name && output->name != (char *) (output + 1))
free(output->name); free(output->name);
output->name = newname; output->name = newname;