raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=de269f4711f2bb3338280879b24e13209e659f14

commit de269f4711f2bb3338280879b24e13209e659f14
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Dec 7 19:50:00 2015 +0900

    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 b526b24..0c73629 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);
 }
 

-- 


Reply via email to