[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-345-gcb6b97b6c

jonathan at claws-mail.org jonathan at claws-mail.org
Fri Oct 29 16:21:20 CET 2021


The branch, gtk3 has been updated
       via  cb6b97b6c43027330d2cbc19af86f53487cfecf2 (commit)
      from  993bb4afaaee499946d5f7f7785293a225ae08e7 (commit)

Summary of changes:
 src/plugins/pgpinline/pgpinline.c | 18 ++++++++++++------
 src/plugins/pgpmime/pgpmime.c     | 21 ++++++++++++++-------
 src/plugins/smime/smime.c         | 21 ++++++++++++++-------
 src/privacy.c                     |  2 ++
 4 files changed, 42 insertions(+), 20 deletions(-)


- Log -----------------------------------------------------------------
commit cb6b97b6c43027330d2cbc19af86f53487cfecf2
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Fri Oct 29 08:56:44 2021 -0700

    Check for null pointer

diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index 37321be9e..8faad1d8c 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -412,7 +412,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 	
 	if (plain == NULL) {
 		g_free(textdata);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
@@ -422,7 +423,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 	if ((dstfp = claws_fopen(fname, "wb")) == NULL) {
 		FILE_OP_ERROR(fname, "claws_fopen");
 		privacy_set_error(_("Couldn't open decrypted file %s"), fname);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		g_free(textdata);
 		g_free(fname);
 		gpgme_data_release(plain);
@@ -497,7 +499,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 		privacy_set_error(_("Couldn't close decrypted file %s"), fname);
         	g_free(fname);
         	gpgme_data_release(plain);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 	
@@ -506,7 +509,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 	
 	if (parseinfo == NULL) {
 		privacy_set_error(_("Couldn't scan decrypted file."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 	decinfo = g_node_first_child(parseinfo->node) != NULL ?
@@ -514,7 +518,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 		
 	if (decinfo == NULL) {
 		privacy_set_error(_("Couldn't scan decrypted file parts."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
@@ -540,7 +545,8 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 	return decinfo;
 
 FILE_ERROR:
-	privacy_free_signature_data(sig_data);
+	if (sig_data)
+		privacy_free_signature_data(sig_data);
 	g_free(textdata);
 	claws_fclose(dstfp);
 	g_free(fname);
diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c
index 5f0ca0b96..a3e1142e6 100644
--- a/src/plugins/pgpmime/pgpmime.c
+++ b/src/plugins/pgpmime/pgpmime.c
@@ -249,7 +249,8 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 	gpgme_data_release(cipher);
 	if (plain == NULL) {
 		debug_print("plain is null!\n");
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
@@ -259,7 +260,8 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 	if ((dstfp = claws_fopen(fname, "wb")) == NULL) {
 		FILE_OP_ERROR(fname, "claws_fopen");
 		privacy_set_error(_("Couldn't open decrypted file %s"), fname);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		g_free(fname);
 		gpgme_data_release(plain);
 		debug_print("can't open!\n");
@@ -270,7 +272,8 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 		FILE_OP_ERROR(fname, "fprintf");
 		claws_fclose(dstfp);
 		privacy_set_error(_("Couldn't write to decrypted file %s"), fname);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		g_free(fname);
 		gpgme_data_release(plain);
 		debug_print("can't open!\n");
@@ -284,7 +287,8 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 			g_free(chars);
 			claws_fclose(dstfp);
 			privacy_set_error(_("Couldn't write to decrypted file %s"), fname);
-			privacy_free_signature_data(sig_data);
+			if (sig_data)
+				privacy_free_signature_data(sig_data);
 			g_free(fname);
 			gpgme_data_release(plain);
 			debug_print("can't open!\n");
@@ -296,7 +300,8 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 	if (claws_safe_fclose(dstfp) == EOF) {
 		FILE_OP_ERROR(fname, "claws_fclose");
 		privacy_set_error(_("Couldn't close decrypted file %s"), fname);
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		g_free(fname);
 		gpgme_data_release(plain);
 		debug_print("can't open!\n");
@@ -307,14 +312,16 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 	g_free(fname);
 	if (parseinfo == NULL) {
 		privacy_set_error(_("Couldn't parse decrypted file."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 	decinfo = g_node_first_child(parseinfo->node) != NULL ?
 		g_node_first_child(parseinfo->node)->data : NULL;
 	if (decinfo == NULL) {
 		privacy_set_error(_("Couldn't parse decrypted file parts."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index f135714c8..477f74c2a 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -586,7 +586,8 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
 	gpgme_data_release(cipher);
 	if (plain == NULL) {
 		debug_print("plain is null!\n");
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
@@ -599,7 +600,8 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
         	gpgme_data_release(plain);
 		debug_print("can't open!\n");
 		privacy_set_error(_("Couldn't open temporary file"));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
     	}
 
@@ -610,7 +612,8 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
         	gpgme_data_release(plain);
 		debug_print("can't close!\n");
 		privacy_set_error(_("Couldn't write to temporary file"));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
@@ -625,7 +628,8 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
         		gpgme_data_release(plain);
 			debug_print("can't write!\n");
 			privacy_set_error(_("Couldn't write to temporary file"));
-			privacy_free_signature_data(sig_data);
+			if (sig_data)
+				privacy_free_signature_data(sig_data);
 			return NULL;
 		}
 	}
@@ -636,7 +640,8 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
         	gpgme_data_release(plain);
 		debug_print("can't close!\n");
 		privacy_set_error(_("Couldn't close temporary file"));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 	g_free(chars);
@@ -645,14 +650,16 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
 	g_free(fname);
 	if (parseinfo == NULL) {
 		privacy_set_error(_("Couldn't parse decrypted file."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 	decinfo = g_node_first_child(parseinfo->node) != NULL ?
 		g_node_first_child(parseinfo->node)->data : NULL;
 	if (decinfo == NULL) {
 		privacy_set_error(_("Couldn't parse decrypted file parts."));
-		privacy_free_signature_data(sig_data);
+		if (sig_data)
+			privacy_free_signature_data(sig_data);
 		return NULL;
 	}
 
diff --git a/src/privacy.c b/src/privacy.c
index a77e9a814..0a1d7881c 100644
--- a/src/privacy.c
+++ b/src/privacy.c
@@ -113,6 +113,8 @@ void privacy_free_signature_data(gpointer data)
 {
 	SignatureData *sig_data = (SignatureData *)data;
 
+	cm_return_if_fail(sig_data != NULL);
+
 	g_free(sig_data->info_short);
 	g_free(sig_data->info_full);
 	g_free(sig_data);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list