From: Werner Koch Date: Wed, 21 Apr 2004 18:14:12 +0000 (+0000) Subject: (gpgme_key_unref): Allow passing NULL like free does. X-Git-Tag: gpgme-1.2.0@1385~444 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=23da302bf3467798a096fd2ff4dd5aa184e08fc9;p=gpgme.git (gpgme_key_unref): Allow passing NULL like free does. The rule of least surprise. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 1abc055..3192ad0 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2004-04-21 Werner Koch + + * key.c (gpgme_key_unref): Allow passing NULL like free does. + The rule of least surprise. + 2004-04-15 Werner Koch * verify.c (prepare_new_sig, _gpgme_verify_status_handler): Remove diff --git a/trunk/gpgme/key.c b/trunk/gpgme/key.c index 05beb11..4634c26 100644 --- a/trunk/gpgme/key.c +++ b/trunk/gpgme/key.c @@ -304,6 +304,9 @@ gpgme_key_unref (gpgme_key_t key) gpgme_user_id_t uid; gpgme_subkey_t subkey; + if (!key) + return; + LOCK (key_ref_lock); assert (key->_refs > 0); if (--key->_refs)