Attempting to track a bug in ecore_x_randr_12 where we get a segfault

when trying to free the mode_info. Not much functional difference with
this commit except that we do not call strndup if the nameLength is
<= 0.



SVN revision: 53477
This commit is contained in:
Christopher Michael 2010-10-15 23:19:45 +00:00
parent 38c32c19a0
commit 50101673d4
1 changed files with 10 additions and 11 deletions

View File

@ -404,15 +404,14 @@ ecore_x_randr_mode_info_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode)
ret->vSyncStart = res->modes[i].vSyncStart;
ret->vSyncEnd = res->modes[i].vSyncEnd;
ret->vTotal = res->modes[i].vTotal;
if (!(ret->name =
strndup(res->modes[i].name, res->modes[i].nameLength)))
{
ret->name = NULL;
ret->nameLength = 0;
}
else
if (res->modes[i].nameLength > 0)
{
ret->nameLength = res->modes[i].nameLength;
ret->name = strndup(res->modes[i].name,
res->modes[i].nameLength);
}
ret->modeFlags = res->modes[i].modeFlags;
break;
}