Fixed bug 1736 - Memory leak in X11_InitModes
tomaszewski.p XRRListOutputProperties allocates Atom* array, which is not freed. XRRGetOutputProperty allocates 'unsigned char *prop' array, which is not freed.
This commit is contained in:
parent
c6ac556871
commit
7c3f6dcb24
1 changed files with 20 additions and 15 deletions
|
@ -576,26 +576,31 @@ X11_InitModes(_THIS)
|
||||||
int actual_format;
|
int actual_format;
|
||||||
unsigned long nitems, bytes_after;
|
unsigned long nitems, bytes_after;
|
||||||
Atom actual_type;
|
Atom actual_type;
|
||||||
|
|
||||||
if (props[i] == EDID) {
|
|
||||||
XRRGetOutputProperty(data->display, res->outputs[output], props[i],
|
|
||||||
0, 100, False, False,
|
|
||||||
AnyPropertyType,
|
|
||||||
&actual_type, &actual_format,
|
|
||||||
&nitems, &bytes_after, &prop);
|
|
||||||
|
|
||||||
MonitorInfo *info = decode_edid(prop);
|
if (props[i] == EDID) {
|
||||||
if (info) {
|
if (XRRGetOutputProperty(data->display,
|
||||||
#ifdef X11MODES_DEBUG
|
res->outputs[output], props[i],
|
||||||
printf("Found EDID data for %s\n", output_info->name);
|
0, 100, False, False,
|
||||||
dump_monitor_info(info);
|
AnyPropertyType,
|
||||||
#endif
|
&actual_type, &actual_format,
|
||||||
SDL_strlcpy(display_name, info->dsc_product_name, sizeof(display_name));
|
&nitems, &bytes_after, &prop) == Success ) {
|
||||||
free(info);
|
MonitorInfo *info = decode_edid(prop);
|
||||||
|
if (info) {
|
||||||
|
#ifdef X11MODES_DEBUG
|
||||||
|
printf("Found EDID data for %s\n", output_info->name);
|
||||||
|
dump_monitor_info(info);
|
||||||
|
#endif
|
||||||
|
SDL_strlcpy(display_name, info->dsc_product_name, sizeof(display_name));
|
||||||
|
free(info);
|
||||||
|
}
|
||||||
|
SDL_free(prop);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (props) {
|
||||||
|
SDL_free(props);
|
||||||
|
}
|
||||||
|
|
||||||
if (*display_name && inches) {
|
if (*display_name && inches) {
|
||||||
size_t len = SDL_strlen(display_name);
|
size_t len = SDL_strlen(display_name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue