From fed2dd711af4132bd9c27ea1c32e9014ea730a8e Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Sun, 9 Jul 2017 15:52:25 +0200 Subject: [PATCH] Minor fixes --- lib/db_x509.cpp | 5 ++--- lib/pki_x509super.cpp | 8 +++++--- widgets/MW_database.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/db_x509.cpp b/lib/db_x509.cpp index 171591e8..61cb1d51 100644 --- a/lib/db_x509.cpp +++ b/lib/db_x509.cpp @@ -257,8 +257,7 @@ void db_x509::inToCont(pki_base *pki) foreach(pki_base *b, items) { pki_crl *crl = static_cast(b); crl->verify(cert); - cert = crl->getIssuer(); - if (!cert) + if (cert != crl->getIssuer()) continue; q.bindValue(0, cert->getSqlItemId()); q.bindValue(1, crl->getSqlItemId()); @@ -916,7 +915,7 @@ void db_x509::do_revoke(QModelIndexList indexes, const x509rev &r) } } if (!parent) { - qWarning("%s(%d): Certs have different/no signer\n", + qWarning("%s(%d): Certs have different/no signer", __func__, __LINE__); } foreach(QModelIndex idx, indexes) { diff --git a/lib/pki_x509super.cpp b/lib/pki_x509super.cpp index 8c099128..dc3877c3 100644 --- a/lib/pki_x509super.cpp +++ b/lib/pki_x509super.cpp @@ -80,13 +80,15 @@ pki_key *pki_x509super::getRefKey() const unsigned pki_x509super::pubHash() { - unsigned hash; + unsigned hash = 0; if (privkey) { hash = privkey->hash(); } else { pki_key *x = getPubKey(); - hash = x->hash(); - delete x; + if (x) { + hash = x->hash(); + delete x; + } } return hash; } diff --git a/widgets/MW_database.cpp b/widgets/MW_database.cpp index 16fa1493..f3208e0d 100644 --- a/widgets/MW_database.cpp +++ b/widgets/MW_database.cpp @@ -479,9 +479,9 @@ void MainWindow::importOldDatabase(QString dbname) delete pki; pki = NULL; } - qDebug() << "load old:" << pki->getIntName(); free(p); if (pki) { + qDebug() << "load old:" << pki->getIntName(); cont->insertPKI(pki); } next: