[balsa] libbalsa/x509-cert-widget: keep scan-build happy



commit e9958cddc192b4a4d03096c0ab572d864eb3fa28
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Jan 8 22:03:32 2020 -0500

    libbalsa/x509-cert-widget: keep scan-build happy
    
    * libbalsa/x509-cert-widget.c (x509_cert_chain_smime): keep
      scan-build happy by checking for NULL chain.

 ChangeLog                   |  7 +++++++
 libbalsa/x509-cert-widget.c | 14 ++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b86bd574e..fe737f2a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-08  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       libbalsa/x509-cert-widget: keep scan-build happy
+
+       * libbalsa/x509-cert-widget.c (x509_cert_chain_smime): keep
+         scan-build happy by checking for NULL chain.
+
 2020-01-08  Peter Bloomfield  <pbloomfield bellsouth net>
 
        balsa-index: do not scroll to first-unread message when
diff --git a/libbalsa/x509-cert-widget.c b/libbalsa/x509-cert-widget.c
index 56d63a3ab..52aeb748c 100644
--- a/libbalsa/x509-cert-widget.c
+++ b/libbalsa/x509-cert-widget.c
@@ -120,12 +120,14 @@ x509_cert_chain_smime(const gchar *fingerprint)
                        chain = g_list_prepend(chain, cert_data_smime(ctx, &keyid));
                }
                gpgme_release(ctx);
-               if (chain->next != NULL) {
-                       widget = create_chain_widget(chain);
-               } else {
-                       widget = ((cert_data_t *) chain->data)->widget;
-               }
-               g_list_free_full(chain, (GDestroyNotify) cert_data_free);
+                if (chain != NULL) {
+                       if (chain->next != NULL) {
+                               widget = create_chain_widget(chain);
+                       } else {
+                               widget = ((cert_data_t *) chain->data)->widget;
+                       }
+                       g_list_free_full(chain, (GDestroyNotify) cert_data_free);
+                }
        }
 
        return widget;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]