[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-198-g86efe37f9

wwp at claws-mail.org wwp at claws-mail.org
Thu Sep 16 10:08:05 CEST 2021


The branch, gtk3 has been updated
       via  86efe37f90a96dd86666bfb4d5d95b8cbdfee096 (commit)
       via  4b7ba8fc844b29f5ab39333b96089c1d176eaf37 (commit)
      from  cb86e0eb6d672e25af39a56c413c33c77cd719c6 (commit)

Summary of changes:
 src/plugins/clamd/libclamd/clamd-plugin.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)


- Log -----------------------------------------------------------------
commit 86efe37f90a96dd86666bfb4d5d95b8cbdfee096
Merge: 4b7ba8fc8 cb86e0eb6
Author: wwp <subscript at free.fr>
Date:   Thu Sep 16 10:07:08 2021 +0200

    Merge branch 'gtk3' of ssh+git://git.claws-mail.org/home/git/claws into gtk3


commit 4b7ba8fc844b29f5ab39333b96089c1d176eaf37
Author: wwp <subscript at free.fr>
Date:   Thu Sep 16 10:06:21 2021 +0200

    Better (and real) fix for CID 1491141 (resource leak), simplify the
    handling of 'value'.

diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
index 58255c431..ee3e4e8bb 100644
--- a/src/plugins/clamd/libclamd/clamd-plugin.c
+++ b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -94,7 +94,6 @@ void clamd_create_config_automatic(const gchar* path) {
 	FILE* conf;
 	char buf[1024];
 	gchar* key = NULL;
-	gchar* value = NULL;
 
 	/*debug_set_mode(TRUE);*/
 	/*debug_print("%s : %s\n", folder, path);*/
@@ -130,6 +129,8 @@ void clamd_create_config_automatic(const gchar* path) {
 		while (*tokens) {
 			const gchar* token = *tokens++;
 			if ((key = g_strstr_len(buf, strlen(buf), token)) != NULL) {
+				gchar* value = NULL;
+
 				gchar* tmp = &(*(key + strlen(token)));
 				tmp = g_strchug(tmp);
 				gchar* end = index(tmp, '#');
@@ -146,7 +147,6 @@ void clamd_create_config_automatic(const gchar* path) {
 						Socket->type = UNIX_SOCKET;
 						Socket->socket.path = g_strdup(value);
 						g_free(value);
-						value = NULL;
 						claws_fclose(conf);
 						debug_print("clamctl: %s\n", Socket->socket.path);
 						return;
@@ -162,8 +162,6 @@ void clamd_create_config_automatic(const gchar* path) {
 							Socket->type = INET_SOCKET;
 							Socket->socket.port = atoi(value);
 							Socket->socket.host = g_strdup("localhost");
-							g_free(value);
-							value = NULL;
 							debug_print("clamctl: %s:%d\n", 
 								Socket->socket.host, Socket->socket.port);
 						}
@@ -171,8 +169,6 @@ void clamd_create_config_automatic(const gchar* path) {
 					else {
 						Socket->type = INET_SOCKET;
 						Socket->socket.port = atoi(value);
-						g_free(value);
-						value = NULL;
 						if (! Socket->socket.host)
 							Socket->socket.host = g_strdup("localhost");
 						debug_print("clamctl: %s:%d\n", 
@@ -188,8 +184,6 @@ void clamd_create_config_automatic(const gchar* path) {
 							Socket->socket.port = 3310; /* default port */
 							Socket->type = INET_SOCKET;
 							Socket->socket.host = g_strdup(value);
-							g_free(value);
-							value = NULL;
 							debug_print("clamctl: %s:%d\n", 
 								Socket->socket.host, Socket->socket.port);
 						}
@@ -199,8 +193,6 @@ void clamd_create_config_automatic(const gchar* path) {
 						if (Socket->socket.host)
 							g_free(Socket->socket.host);
 						Socket->socket.host = g_strdup(value);
-						g_free(value);
-						value = NULL;
 						if (Socket->socket.port == -1)
 							Socket->socket.port = 3310;
 						debug_print("clamctl: %s:%d\n", 
@@ -208,12 +200,11 @@ void clamd_create_config_automatic(const gchar* path) {
 					}
 					/* We must continue since TCPSocket could also be configured */
 				}
+				g_free(value);
 			}
 		}
 	}
 	claws_fclose(conf);
-	if (value)
-		g_free(value);
 	if (! (Socket && (Socket->socket.port || Socket->socket.path))) {
 		/*g_error("%s: Not able to find required information", path);*/
 		alertpanel_error(_("%s: Not able to find required information\nclamd will be disabled"), path);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list