[Commits] [SCM] claws branch, master, updated. 3.18.0-196-gb589f44bb

wwp at claws-mail.org wwp at claws-mail.org
Tue Sep 28 17:40:46 CEST 2021


The branch, master has been updated
       via  b589f44bbd4acb683c6b2c826e42823efbe24632 (commit)
      from  da9933b20717015a7053fde0637550d6f33a2ea8 (commit)

Summary of changes:
 src/plugins/pgpinline/pgpinline.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)


- Log -----------------------------------------------------------------
commit b589f44bbd4acb683c6b2c826e42823efbe24632
Author: wwp <subscript at free.fr>
Date:   Tue Sep 28 17:40:39 2021 +0200

    Fix CID 1492200 and 1491225: resource leaks.

diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index 35ca8f8af..9b81fdcc9 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -72,6 +72,7 @@ static PrivacyDataPGP *pgpinline_new_privacydata()
 	data->sigstatus = NULL;
 	if ((err = gpgme_new(&data->ctx)) != GPG_ERR_NO_ERROR) {
 		debug_print(("Couldn't initialize GPG context, %s\n"), gpgme_strerror(err));
+        g_free(data);
 		return NULL;
 	}
 	
@@ -657,6 +658,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 		debug_print(("Couldn't initialize GPG context, %s\n"), gpgme_strerror(err));
 		privacy_set_error(_("Couldn't initialize GPG context, %s"), gpgme_strerror(err));
 		g_free(kset);
+		g_free(fprs);
 		return FALSE;
 	}
 	i = 0;
@@ -667,13 +669,13 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 			debug_print("can't add key '%s'[%d] (%s)\n", fprs[i],i, gpgme_strerror(err));
 			privacy_set_error(_("Couldn't add GPG key %s, %s"), fprs[i], gpgme_strerror(err));
 			g_free(kset);
+			g_free(fprs);
 			return FALSE;
 		}
 		debug_print("found %s at %d\n", fprs[i], i);
 		kset[i] = key;
 		i++;
 	}
-	
 
 	debug_print("Encrypting message content\n");
 
@@ -684,6 +686,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 			debug_print("msgcontent->node->children NULL, bailing\n");
 			privacy_set_error(_("Malformed message"));
 			g_free(kset);
+			g_free(fprs);
 			return FALSE;
 		}
 		msgcontent = (MimeInfo *) msgcontent->node->children->data;
@@ -696,6 +699,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 		privacy_set_error(_("Couldn't create temporary file, %s"), g_strerror(errno));
 		perror("my_tmpfile");
 		g_free(kset);
+		g_free(fprs);
 		return FALSE;
 	}
 	procmime_write_mimeinfo(msgcontent, fp);
@@ -713,6 +717,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 		debug_print(("Couldn't initialize GPG context, %s\n"), gpgme_strerror(err));
 		privacy_set_error(_("Couldn't initialize GPG context, %s"), gpgme_strerror(err));
 		g_free(kset);
+		g_free(fprs);
 		return FALSE;
 	}
 	gpgme_set_armor(ctx, 1);
@@ -729,6 +734,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 		g_free(textstr);
 		gpgme_release(ctx);
 		g_free(enccontent);
+		g_free(fprs);
 		return FALSE;
 	}
 
@@ -751,6 +757,8 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	g_free(tmp);
 	gpgme_release(ctx);
 
+	g_free(fprs);
+
 	return TRUE;
 }
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list