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;
|
||||
unsigned long nitems, bytes_after;
|
||||
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 (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);
|
||||
if (props[i] == EDID) {
|
||||
if (XRRGetOutputProperty(data->display,
|
||||
res->outputs[output], props[i],
|
||||
0, 100, False, False,
|
||||
AnyPropertyType,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after, &prop) == Success ) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (props) {
|
||||
SDL_free(props);
|
||||
}
|
||||
|
||||
if (*display_name && inches) {
|
||||
size_t len = SDL_strlen(display_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue