changeset 145:0ded526c449a

Fix a memory leak when showing existing instances of windows. Also fix layout issues with the hostname field.
author Brian Smith <brian@dbsoft.org>
date Fri, 22 Oct 2021 15:11:29 -0500
parents fc6f7cc9f793
children d0ffc7689da4
files src/handyftp.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/handyftp.c	Tue Oct 19 06:02:42 2021 -0500
+++ b/src/handyftp.c	Fri Oct 22 15:11:29 2021 -0500
@@ -2138,8 +2138,8 @@
 void about(void)
 {
 	HWND infowindow, mainbox, logo, okbutton, buttonbox, stext, mle;
-	UserEntry *param = malloc(sizeof(UserEntry));
 	ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_DLGBORDER | DW_FCF_TEXTURED;
+	UserEntry *param;
 	int point = -1;
 	char *greets = "Thanks to the OS/2 Netlabs, OS2.org, Narayan Desai, Terje Flaaronning, " \
 		"Geoff Freimark, Vidas Simkus, Jeff LeClere, Valerie Smith, Gene Akins, " \
@@ -2202,6 +2202,7 @@
 	dw_box_pack_start(buttonbox, okbutton, -1, -1, FALSE, FALSE, 2);
 	dw_box_pack_start(buttonbox, 0, 50, 30, TRUE, FALSE, 0);
 
+	param = malloc(sizeof(UserEntry));
 	param->window = infowindow;
 	param->data = NULL;
 	param->busy = &in_about;
@@ -2220,10 +2221,9 @@
 /* Create the preferences dialog */
 void preferences(void)
 {
-	HWND entrywindow, mainbox, hbox, cancelbutton, okbutton, buttonbox,
-		xbox, stext, *handles = malloc(10 * sizeof(HWND));
-	UserEntry *param = malloc(sizeof(UserEntry));
+	HWND entrywindow, mainbox, hbox, cancelbutton, okbutton, buttonbox, xbox, stext, *handles;
 	ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_DLGBORDER | DW_FCF_TEXTURED;
+	UserEntry *param;
 
 	if(in_preferences)
 	{
@@ -2231,6 +2231,8 @@
 		return;
 	}
 
+	handles = malloc(10 * sizeof(HWND));
+	
 	in_preferences = entrywindow = dw_window_new(HWND_DESKTOP, locale_string("Preferences", 55), flStyle);
 
 	xbox = dw_box_new(BOXVERT, 5);
@@ -2380,6 +2382,7 @@
 	/* Padding to compensate for the button box on the left. */
 	dw_box_pack_start(buttonbox, 0, 40, 30, TRUE, TRUE, 4);
 
+	param = malloc(sizeof(UserEntry));
 	param->page = currentpage;
 	param->window = entrywindow;
 	param->filename = NULL;
@@ -5391,7 +5394,7 @@
 
 	site[thispage]->host_name = dw_entryfield_new("", EF_HOSTNAME);
 
-	dw_box_pack_start(controlbox, site[thispage]->host_name, 160, 22, TRUE, FALSE, 0);
+	dw_box_pack_start(controlbox, site[thispage]->host_name, 160, -1, TRUE, TRUE, 0);
     dw_window_set_tooltip(site[thispage]->host_name, "Internet name or address of the server; or local.");
 
 	stext = dw_text_new(locale_string("Port:", 147), 0);