mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #12334 from akallabeth/x11-leak-fix
[client,x11] fix XGetWindowProperty return handling
This commit is contained in:
@@ -1125,6 +1125,8 @@ static BOOL xf_cliprdr_get_requested_data(xfClipboard* clipboard, Atom target)
|
|||||||
const int rc = LogDynAndXGetWindowProperty(
|
const int rc = LogDynAndXGetWindowProperty(
|
||||||
xfc->log, xfc->display, xfc->drawable, clipboard->property_atom, 0, 0, False, target, &type,
|
xfc->log, xfc->display, xfc->drawable, clipboard->property_atom, 0, 0, False, target, &type,
|
||||||
&format_property, &length, &total_bytes, &property_data);
|
&format_property, &length, &total_bytes, &property_data);
|
||||||
|
if (property_data)
|
||||||
|
XFree(property_data);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
|
xf_cliprdr_send_data_response(clipboard, format, NULL, 0);
|
||||||
|
|||||||
@@ -480,6 +480,8 @@ BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int leng
|
|||||||
Atom actual_type = None;
|
Atom actual_type = None;
|
||||||
int actual_format = 0;
|
int actual_format = 0;
|
||||||
|
|
||||||
|
WINPR_ASSERT(prop);
|
||||||
|
|
||||||
if (property == None)
|
if (property == None)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -493,6 +495,9 @@ BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int leng
|
|||||||
if (actual_type == None)
|
if (actual_type == None)
|
||||||
{
|
{
|
||||||
WLog_DBG(TAG, "Property %lu does not exist", (unsigned long)property);
|
WLog_DBG(TAG, "Property %lu does not exist", (unsigned long)property);
|
||||||
|
if (*prop)
|
||||||
|
XFree(*prop);
|
||||||
|
*prop = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,16 +518,18 @@ static BOOL xf_GetNumberOfDesktops(xfContext* xfc, Window root, unsigned* pval)
|
|||||||
|
|
||||||
long* prop = (long*)bprop;
|
long* prop = (long*)bprop;
|
||||||
*pval = 0;
|
*pval = 0;
|
||||||
if (!rc)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
BOOL res = FALSE;
|
BOOL res = FALSE;
|
||||||
if ((*prop >= 0) && (*prop <= UINT32_MAX))
|
if (rc)
|
||||||
{
|
{
|
||||||
*pval = (UINT32)*prop;
|
if ((*prop >= 0) && (*prop <= UINT32_MAX))
|
||||||
res = TRUE;
|
{
|
||||||
|
*pval = (UINT32)*prop;
|
||||||
|
res = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
XFree(prop);
|
if (prop)
|
||||||
|
XFree(prop);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,12 +550,11 @@ static BOOL xf_GetCurrentDesktop(xfContext* xfc, Window root)
|
|||||||
|
|
||||||
long* prop = (long*)bprop;
|
long* prop = (long*)bprop;
|
||||||
xfc->current_desktop = 0;
|
xfc->current_desktop = 0;
|
||||||
if (!rc)
|
if (rc)
|
||||||
return FALSE;
|
xfc->current_desktop = (int)MIN(max - 1, *prop);
|
||||||
|
if (prop)
|
||||||
xfc->current_desktop = (int)MIN(max - 1, *prop);
|
XFree(prop);
|
||||||
XFree(prop);
|
return rc;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL xf_GetWorkArea_NET_WORKAREA(xfContext* xfc, Window root)
|
static BOOL xf_GetWorkArea_NET_WORKAREA(xfContext* xfc, Window root)
|
||||||
|
|||||||
Reference in New Issue
Block a user