From ca3e4460e5e4334aef6ac8f6dfe4e65875e621e5 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 7 Dec 2015 19:50:00 +0900 Subject: [PATCH] e randr - fix silent free of data behind randr's back this fixes a bizarrre issue that valgrind reported that has the strings we malloc and fill somehow being freed by xlib. totally didn't make sense. either way, a workaround here is to strdup them immediately and free the tmp copy and oddly the bug doesn't happen. this is very odd. @fix --- src/bin/e_comp_x_randr.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bin/e_comp_x_randr.c b/src/bin/e_comp_x_randr.c index b526b24cc..0c736296d 100644 --- a/src/bin/e_comp_x_randr.c +++ b/src/bin/e_comp_x_randr.c @@ -55,7 +55,13 @@ _output_screen_get(Ecore_X_Window root, Ecore_X_Randr_Output o) if (!edid) return NULL; name = ecore_x_randr_edid_display_name_get(edid, len); free(edid); - return name; + if (name) + { + char *name2 = strdup(name); + free(name); + return name2; + } + return NULL; } static Ecore_X_Randr_Edid_Display_Interface_Type @@ -76,7 +82,12 @@ _output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output o) { // get the output name - like connector (hdmi-0, dp1, dvi-0-1 etc.) char *name = ecore_x_randr_output_name_get(root, o, NULL); - if (name) return name; + if (name) + { + char *name2 = strdup(name); + free(name); + return name2; + } return _output_screen_get(root, o); }