Fix memory leak spotted by valgrind.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1182 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
d5fe3cead6
commit
9babc7a978
15
ewmhints.c
15
ewmhints.c
@ -237,16 +237,23 @@ ewmh_modify_state(Window wnd, int add, Atom atom1, Atom atom2)
|
||||
Status status;
|
||||
XEvent xevent;
|
||||
|
||||
int result;
|
||||
unsigned long nitems;
|
||||
unsigned char *props;
|
||||
uint32 *state;
|
||||
uint32 state;
|
||||
|
||||
/* The spec states that the window manager must respect any
|
||||
_NET_WM_STATE attributes on a withdrawn window. In order words, we
|
||||
modify the attributes directly for withdrawn windows and ask the WM
|
||||
to do it for active windows. */
|
||||
if ((get_property_value(wnd, "WM_STATE", 64, &nitems, &props, 1) < 0)
|
||||
|| ((state = (uint32 *) props)[0] == WithdrawnState))
|
||||
result = get_property_value(wnd, "WM_STATE", 64, &nitems, &props, 1);
|
||||
if ((result >= 0) && nitems)
|
||||
{
|
||||
state = *(uint32 *) props;
|
||||
XFree(props);
|
||||
}
|
||||
|
||||
if ((result < 0) || !nitems || (state == WithdrawnState))
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
@ -287,6 +294,8 @@ ewmh_modify_state(Window wnd, int add, Atom atom1, Atom atom2)
|
||||
|
||||
XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
|
||||
32, PropModeReplace, (unsigned char *) atoms, nitems);
|
||||
|
||||
XFree(props);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
11
secure.c
11
secure.c
@ -533,6 +533,7 @@ sec_parse_x509_key(X509 * cert)
|
||||
if (OBJ_obj2nid(cert->cert_info->key->algor->algorithm) == NID_md5WithRSAEncryption)
|
||||
{
|
||||
DEBUG_RDP5(("Re-setting algorithm type to RSA in server certificate\n"));
|
||||
ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm);
|
||||
cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption);
|
||||
}
|
||||
epk = X509_get_pubkey(cert);
|
||||
@ -542,7 +543,9 @@ sec_parse_x509_key(X509 * cert)
|
||||
return False;
|
||||
}
|
||||
|
||||
server_public_key = (RSA *) epk->pkey.ptr;
|
||||
server_public_key = RSAPublicKey_dup((RSA *) epk->pkey.ptr);
|
||||
|
||||
EVP_PKEY_free(epk);
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -680,6 +683,8 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
|
||||
MITM-attacks.
|
||||
*/
|
||||
|
||||
X509_free(cacert);
|
||||
|
||||
in_uint32_le(s, cert_len);
|
||||
DEBUG_RDP5(("Certificate length is %d\n", cert_len));
|
||||
server_cert = d2i_X509(NULL, &(s->p), cert_len);
|
||||
@ -698,8 +703,10 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
|
||||
if (!sec_parse_x509_key(server_cert))
|
||||
{
|
||||
DEBUG_RDP5(("Didn't parse X509 correctly\n"));
|
||||
X509_free(server_cert);
|
||||
return False;
|
||||
}
|
||||
X509_free(server_cert);
|
||||
return True; /* There's some garbage here we don't care about */
|
||||
}
|
||||
return s_check_end(s);
|
||||
@ -745,6 +752,8 @@ sec_process_crypt_info(STREAM s)
|
||||
|
||||
reverse(sec_crypted_random, SEC_MODULUS_SIZE);
|
||||
|
||||
RSA_free(server_public_key);
|
||||
server_public_key = NULL;
|
||||
}
|
||||
else
|
||||
{ /* RDP4-style encryption */
|
||||
|
16
xwin.c
16
xwin.c
@ -320,6 +320,7 @@ sw_remove_window(seamless_window * win)
|
||||
XDestroyWindow(g_display, sw->group->wnd);
|
||||
xfree(sw->group);
|
||||
}
|
||||
xfree(sw->position_timer);
|
||||
xfree(sw);
|
||||
return;
|
||||
}
|
||||
@ -441,7 +442,7 @@ sw_handle_restack(seamless_window * sw)
|
||||
{
|
||||
i++;
|
||||
if (i >= nchildren)
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i++; i < nchildren; i++)
|
||||
@ -452,9 +453,9 @@ sw_handle_restack(seamless_window * sw)
|
||||
}
|
||||
|
||||
if (!sw_below && !sw->behind)
|
||||
return;
|
||||
goto end;
|
||||
if (sw_below && (sw_below->id == sw->behind))
|
||||
return;
|
||||
goto end;
|
||||
|
||||
if (sw_below)
|
||||
{
|
||||
@ -466,6 +467,9 @@ sw_handle_restack(seamless_window * sw)
|
||||
seamless_send_zchange(sw->id, 0, 0);
|
||||
sw_restack_window(sw, 0);
|
||||
}
|
||||
|
||||
end:
|
||||
XFree(children);
|
||||
}
|
||||
|
||||
|
||||
@ -1626,6 +1630,12 @@ ui_init(void)
|
||||
void
|
||||
ui_deinit(void)
|
||||
{
|
||||
while (g_seamless_windows)
|
||||
{
|
||||
XDestroyWindow(g_display, g_seamless_windows->wnd);
|
||||
sw_remove_window(g_seamless_windows);
|
||||
}
|
||||
|
||||
if (g_IM != NULL)
|
||||
XCloseIM(g_IM);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user