Initialize Mode->name in xf86CVTMode()

This was overlooked when converting the function to use libxcvt.
Bring back name initialization from old code.

This was causing a segfault in xf86LookupMode() if modes where
name is NULL are present the modePool list.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
This commit is contained in:
Matthieu Herrb 2021-12-05 22:05:08 +01:00
parent 0146fd6d36
commit ed11c4d443

View File

@ -803,10 +803,14 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
{
struct libxcvt_mode_info *libxcvt_mode_info;
DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
char *tmp;
libxcvt_mode_info =
libxcvt_gen_mode_info(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay);
Mode->name = tmp;
Mode->VDisplay = libxcvt_mode_info->vdisplay;
Mode->HDisplay = libxcvt_mode_info->hdisplay;
Mode->Clock = libxcvt_mode_info->dot_clock;