[Commits] [SCM] claws branch, master, updated. 3.18.0-187-g3b1b04062

wwp at claws-mail.org wwp at claws-mail.org
Tue Sep 28 14:45:40 CEST 2021


The branch, master has been updated
       via  3b1b0406282b260339f3bb070d515d829036b5f4 (commit)
      from  8856d58a488acc87089c85122f3235bbd32a5006 (commit)

Summary of changes:
 src/plugins/smime/smime.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 3b1b0406282b260339f3bb070d515d829036b5f4
Author: wwp <subscript at free.fr>
Date:   Tue Sep 28 14:45:12 2021 +0200

    Fix CID 1491069 and 1491256: resource leaks.

diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index b8905f3ae..976039486 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -744,6 +744,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 
 	if ((err = gpgme_new(&ctx)) != GPG_ERR_NO_ERROR) {
 		debug_print ("gpgme_new failed: %s\n", gpgme_strerror(err));
+		g_free(fprs);
 		return FALSE;
 	}
 
@@ -752,6 +753,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	if (err) {
 		debug_print ("gpgme_set_protocol failed: %s\n",
                    gpgme_strerror (err));
+		g_free(fprs);
 		return FALSE;
 	}
 
@@ -771,7 +773,8 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 		kset[i] = key;
 		i++;
 	}
-	
+	g_free(fprs);
+
 	debug_print("Encrypting message content\n");
 
 	/* remove content node from message */
@@ -801,6 +804,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	if (fp == NULL) {
 		FILE_OP_ERROR(tmpfile, "create");
 		g_free(kset);
+		g_free(tmpfile);
 		return FALSE;
 	}
 	procmime_decode_content(msgcontent);
@@ -812,6 +816,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	if (fp == NULL) {
 		FILE_OP_ERROR(tmpfile, "open");
 		g_free(kset);
+		g_free(tmpfile);
 		return FALSE;
 	}
 	g_free(tmpfile);
@@ -846,7 +851,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 			claws_unlink(tmpfile);
 			g_free(tmpfile);
 			g_free(enccontent);
-			return FALSE;
+			g_free(tmpfile);
 		}
 		if (claws_safe_fclose(fp) == EOF) {
 			FILE_OP_ERROR(tmpfile, "claws_fclose");

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list