summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2021-12-05 22:05:08 +0100
committerMarge Bot <emma+marge@anholt.net>2024-02-23 00:01:10 +0000
commit8a46a463f631ed52613d67f4088924acbbb6ca20 (patch)
tree073b296f02af5d5d7863c72f0f880415089bd39c
parentf653d9a0af912e577fab5c02b2a4eb380d33e8bb (diff)
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> --- (cherry picked from ed11c4d443ad2e82512df64358d38008e0ee7693) Reported-by: "Sergiy" <Black_N@ukr.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1319>
-rw-r--r--hw/xfree86/modes/xf86Modes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 384996724..00586c457 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -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;