Fix big mistake in commit fd41f46ac6
.
- When a mode is deleted, the name pointer is also free()'ed. - This leaves other modes with an invalid pointer.
This commit is contained in:
parent
ef60632e20
commit
8af2c39bcc
|
@ -214,8 +214,15 @@ xf86DuplicateMode(DisplayModePtr pMode)
|
|||
*pNew = *pMode;
|
||||
pNew->next = NULL;
|
||||
pNew->prev = NULL;
|
||||
if (pNew->name == NULL)
|
||||
/*
|
||||
* It is important to copy the name explicitly.
|
||||
* Otherwise a mode could reference an invalid piece of memory, after one of them runs free().
|
||||
* This will lead to obscure problems, that you really don't want.
|
||||
*/
|
||||
if (pMode->name == NULL)
|
||||
xf86SetModeDefaultName(pNew);
|
||||
else
|
||||
pNew->name = xnfstrdup(pMode->name);
|
||||
|
||||
return pNew;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user