[Commits] [SCM] claws branch, master, updated. 3.18.0-139-g9283cb6a6
wwp at claws-mail.org
wwp at claws-mail.org
Thu Sep 16 10:08:29 CEST 2021
The branch, master has been updated
via 9283cb6a604242676bad72b907c2a60df9871b0d (commit)
from 0d164d3e260c44584e96f95df12fbea4b3466867 (commit)
Summary of changes:
src/plugins/clamd/libclamd/clamd-plugin.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 9283cb6a604242676bad72b907c2a60df9871b0d
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