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
devs/stanluk/a11y
Carsten Haitzler 7 years ago
parent f88ed7c7fb
commit de269f4711
  1. 15
      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);
}

Loading…
Cancel
Save