[Commits] [SCM] claws branch, gtk3tree, updated. 4.0.0-398-g85739c8e5
paul at claws-mail.org
paul at claws-mail.org
Wed Nov 3 11:32:23 UTC 2021
The branch, gtk3tree has been updated
via 85739c8e56468ec73c41a17c1c1eb051a0df03cb (commit)
from 82c22c4177777819397c7bfd70bedcf2b6d81054 (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 85739c8e56468ec73c41a17c1c1eb051a0df03cb
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