Commit 8af2c39b authored by Maarten Maathuis's avatar Maarten Maathuis

Fix big mistake in commit fd41f46a.

- When a mode is deleted, the name pointer is also free()'ed.
- This leaves other modes with an invalid pointer.
parent ef60632e
......@@ -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)
pNew->name = xnfstrdup(pMode->name);
return pNew;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment