From d1aa2ac5dddf6b8c8c1333aae415abda9ad72d85 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Oct 2013 16:22:59 +0100 Subject: [PATCH] sna: Steal the current mode name Rather than duplicating a string, we can simply transfer ownership from the temporary mode to the mode list. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index e893bcd7..71c4c605 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2112,7 +2112,8 @@ sna_output_get_modes(xf86OutputPtr output) Mode = calloc(1, sizeof(DisplayModeRec)); if (Mode) { *Mode = current; - Mode->name = strdup(Mode->name); + current.name = NULL; + output->probed_modes = xf86ModesAdd(output->probed_modes, Mode); }