[Commits] [SCM] claws branch, master, updated. 3.18.0-115-g69f0c0e70

wwp at claws-mail.org wwp at claws-mail.org
Sun Sep 12 14:19:09 CEST 2021


The branch, master has been updated
       via  69f0c0e7000e8d6cb2803a8b923c8b413ce20e7c (commit)
      from  fe2c6b9d2f8abed0b997cda34618b70e57cc4b5f (commit)

Summary of changes:
 src/action.c                      | 19 ++++++++++++-------
 src/inc.c                         |  9 ++++++---
 src/plugins/pgpcore/select-keys.c | 16 ++++++++++------
 3 files changed, 28 insertions(+), 16 deletions(-)


- Log -----------------------------------------------------------------
commit 69f0c0e7000e8d6cb2803a8b923c8b413ce20e7c
Author: wwp <subscript at free.fr>
Date:   Sun Sep 12 14:16:03 2021 +0200

    Fix CID 1491213, 1491253, 1491103 and 1491189: resource leaks (if
    g_locale_from_utf8() returns an empty string, still to free).

diff --git a/src/action.c b/src/action.c
index 12029f8d4..8d22599c8 100644
--- a/src/action.c
+++ b/src/action.c
@@ -1517,9 +1517,12 @@ static void catch_input(gpointer data, gint source, GIOCondition cond)
 				       0, -1);
 	ret_str = g_locale_from_utf8(input, strlen(input), &by_read,
 				     &by_written, NULL);
-	if (ret_str && by_written) {
-		g_free(input);
-		input = ret_str;
+	if (ret_str) {
+		if (by_written) {
+			g_free(input);
+			input = ret_str;
+		} else
+			g_free(ret_str);
 	}
 
 	len = strlen(input);
@@ -1600,10 +1603,12 @@ static void catch_output(gpointer data, gint source, GIOCondition cond)
 			buf[c] = 0;
 			ret_str = g_locale_to_utf8
 				(buf, c, &bytes_read, &bytes_written, NULL);
-			if (ret_str && bytes_written > 0) {
-				g_string_append_len
-					(child_info->output, ret_str,
-					 bytes_written);
+			if (ret_str) {
+				if (bytes_written) {
+					g_string_append_len
+						(child_info->output, ret_str,
+						bytes_written);
+				}
 				g_free(ret_str);
 			} else
 				g_string_append_len(child_info->output, buf, c);
diff --git a/src/inc.c b/src/inc.c
index 25f724330..85250e32d 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -1486,9 +1486,12 @@ static void inc_notify_cmd(gint new_msgs, gboolean notify)
 
 	ret_str = g_locale_from_utf8(buf, strlen(buf), &by_read, &by_written,
 				     NULL);
-	if (ret_str && by_written) {
-		g_free(buf);
-		buf = ret_str;
+	if (ret_str) {
+		if (by_written) {
+			g_free(buf);
+			buf = ret_str;
+		} else
+			g_free(ret_str);
 	}
 	debug_print("executing new mail notification command: %s\n", buf);
 	execute_command_line(buf, TRUE, NULL);
diff --git a/src/plugins/pgpcore/select-keys.c b/src/plugins/pgpcore/select-keys.c
index cb9cb7847..64ab9ce61 100644
--- a/src/plugins/pgpcore/select-keys.c
+++ b/src/plugins/pgpcore/select-keys.c
@@ -206,13 +206,15 @@ set_row (GtkListStore *store, gpgme_key_t key, gpgme_protocol_t proto)
         s = ret_str;
     }
     name = g_strdup(s);
+    if (ret_str)
+        g_free(ret_str);
 
     if (proto == GPGME_PROTOCOL_CMS && (!key->uids->email || !*key->uids->email)) {
-	gpgme_user_id_t uid = key->uids->next;
-	if (uid)
-		s = uid->email;
-	else
-		s = key->uids->email;
+        gpgme_user_id_t uid = key->uids->next;
+        if (uid)
+            s = uid->email;
+        else
+            s = key->uids->email;
     } else {
         s = key->uids->email;
     }
@@ -224,6 +226,8 @@ set_row (GtkListStore *store, gpgme_key_t key, gpgme_protocol_t proto)
         s = ret_str;
     }
     address = g_strdup(s);
+    if (ret_str)
+        g_free(ret_str);
 
     switch (key->uids->validity)
       {
@@ -261,7 +265,7 @@ set_row (GtkListStore *store, gpgme_key_t key, gpgme_protocol_t proto)
 
     g_free(name);
     g_free(address);
-    g_free (algo_buf);
+    g_free(algo_buf);
 }
 
 static gpgme_key_t 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list