xf86ValidateModes: xnfalloc(strlen) + strcpy => xnfstrdup

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Alan Coopersmith 2010-11-27 23:49:55 -08:00
parent 29e467a1f1
commit 2c8e534c8e

View File

@ -1643,8 +1643,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
new = xnfcalloc(1, sizeof(DisplayModeRec)); new = xnfcalloc(1, sizeof(DisplayModeRec));
new->prev = last; new->prev = last;
new->type = M_T_USERDEF; new->type = M_T_USERDEF;
new->name = xnfalloc(strlen(modeNames[i]) + 1); new->name = xnfstrdup(modeNames[i]);
strcpy(new->name, modeNames[i]);
if (new->prev) if (new->prev)
new->prev->next = new; new->prev->next = new;
*endp = last = new; *endp = last = new;
@ -1716,10 +1715,9 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
p = xnfcalloc(1, sizeof(DisplayModeRec)); p = xnfcalloc(1, sizeof(DisplayModeRec));
p->prev = last; p->prev = last;
p->name = xnfalloc(strlen(r->name) + 1); p->name = xnfstrdup(r->name);
if (!userModes) if (!userModes)
p->type = M_T_USERDEF; p->type = M_T_USERDEF;
strcpy(p->name, r->name);
if (p->prev) if (p->prev)
p->prev->next = p; p->prev->next = p;
*endp = last = p; *endp = last = p;