commit 2d39e4b7aaae907241103a23fc003737ba9eba69
parent 5618ef004fa350901e9b09fb9c742b6216dfc5d0
Author: wwp <subscript@free.fr>
Date: Thu, 16 Sep 2021 00:43:08 +0200
Fix CID 1491141, 149246: resource leaks.
Fix CID 1491291: ensure string in buffer is 0-ended.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -212,6 +212,8 @@ void clamd_create_config_automatic(const gchar* path) {
}
}
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);
@@ -603,11 +605,13 @@ GSList* clamd_verify_dir(const gchar* path) {
if (write(sock, command, strlen(command)) == -1) {
debug_print("write error %d\n", errno);
close(sock);
+ g_free(command);
return list;
}
g_free(command);
memset(buf, '\0', sizeof(buf));
while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
+ buf[n_read] = 0;
gchar** tmp = g_strsplit(buf, "\n", 0);
gchar** head = tmp;
while (*tmp) {