hardening delete operator
Make sure that delete operator is not called with invalid pointers.
Change-Id: I822b670c63bd40234aef0213517914fdcc7b68e9
Reviewed-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
diff --git a/src/accountsecuritytab.cpp b/src/accountsecuritytab.cpp
index d298aaa..e3a23f0 100644
--- a/src/accountsecuritytab.cpp
+++ b/src/accountsecuritytab.cpp
@@ -109,7 +109,10 @@
AccountSecurityTab *view = ACCOUNT_SECURITY_TAB(object);
AccountSecurityTabPrivate *priv = ACCOUNT_SECURITY_TAB_GET_PRIVATE(view);
- delete priv->qmodel_key_exchange;
+ if (priv->qmodel_key_exchange) {
+ delete priv->qmodel_key_exchange;
+ priv->qmodel_key_exchange = nullptr;
+ }
G_OBJECT_CLASS(account_security_tab_parent_class)->finalize(object);
}