CVS: rdesktop ewmhints.c,1.10.2.9,1.10.2.10 secure.c,1.55,1.55.2.1 xwin.c,1.205.2.34,1.205.2.35

Pierre Ossman <[email protected]> Wed, 22 Mar 2006 01:49:23 -0800
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4942

Modified Files:
      Tag: seamlessrdp-branch
	ewmhints.c secure.c xwin.c 
Log Message:
Fix memory leak spotted by valgrind.


Index: ewmhints.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/ewmhints.c,v
retrieving revision 1.10.2.9
retrieving revision 1.10.2.10
diff -C2 -d -r1.10.2.9 -r1.10.2.10
*** ewmhints.c	21 Mar 2006 14:42:24 -0000	1.10.2.9
--- ewmhints.c	22 Mar 2006 09:49:20 -0000	1.10.2.10
***************
*** 238,244 ****
  	XEvent xevent;
  
  	unsigned long nitems;
  	unsigned char *props;
! 	uint32 *state;
  
  	/* The spec states that the window manager must respect any
--- 238,245 ----
  	XEvent xevent;
  
+ 	int result;
  	unsigned long nitems;
  	unsigned char *props;
! 	uint32 state;
  
  	/* The spec states that the window manager must respect any
***************
*** 246,251 ****
  	   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))
  	{
  		if (add)
--- 247,258 ----
  	   modify the attributes directly for withdrawn windows and ask the WM
  	   to do it for active windows. */
! 	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)
***************
*** 288,291 ****
--- 295,300 ----
  			XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
  					32, PropModeReplace, (unsigned char *) atoms, nitems);
+ 
+ 			XFree(props);
  		}
  

Index: secure.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/secure.c,v
retrieving revision 1.55
retrieving revision 1.55.2.1
diff -C2 -d -r1.55 -r1.55.2.1
*** secure.c	24 Jan 2006 12:40:24 -0000	1.55
--- secure.c	22 Mar 2006 09:49:21 -0000	1.55.2.1
***************
*** 534,537 ****
--- 534,538 ----
  	{
  		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);
  	}
***************
*** 543,547 ****
  	}
  
! 	server_public_key = (RSA *) epk->pkey.ptr;
  
  	return True;
--- 544,550 ----
  	}
  
! 	server_public_key = RSAPublicKey_dup((RSA *) epk->pkey.ptr);
! 
! 	EVP_PKEY_free(epk);
  
  	return True;
***************
*** 681,684 ****
--- 684,689 ----
  		 */
  
+ 		X509_free(cacert);
+ 
  		in_uint32_le(s, cert_len);
  		DEBUG_RDP5(("Certificate length is %d\n", cert_len));
***************
*** 699,704 ****
--- 704,711 ----
  		{
  			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 */
  	}
***************
*** 746,749 ****
--- 753,758 ----
  		reverse(sec_crypted_random, SEC_MODULUS_SIZE);
  
+ 		RSA_free(server_public_key);
+ 		server_public_key = NULL;
  	}
  	else

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.34
retrieving revision 1.205.2.35
diff -C2 -d -r1.205.2.34 -r1.205.2.35
*** xwin.c	21 Mar 2006 15:31:48 -0000	1.205.2.34
--- xwin.c	22 Mar 2006 09:49:21 -0000	1.205.2.35
***************
*** 321,324 ****
--- 321,325 ----
  				xfree(sw->group);
  			}
+ 			xfree(sw->position_timer);
  			xfree(sw);
  			return;
***************
*** 442,446 ****
  		i++;
  		if (i >= nchildren)
! 			return;
  	}
  
--- 443,447 ----
  		i++;
  		if (i >= nchildren)
! 			goto end;
  	}
  
***************
*** 453,459 ****
  
  	if (!sw_below && !sw->behind)
! 		return;
  	if (sw_below && (sw_below->id == sw->behind))
! 		return;
  
  	if (sw_below)
--- 454,460 ----
  
  	if (!sw_below && !sw->behind)
! 		goto end;
  	if (sw_below && (sw_below->id == sw->behind))
! 		goto end;
  
  	if (sw_below)
***************
*** 467,470 ****
--- 468,474 ----
  		sw_restack_window(sw, 0);
  	}
+ 
+       end:
+ 	XFree(children);
  }
  
***************
*** 1627,1630 ****
--- 1631,1640 ----
  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);



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642