(gpgme_key_unref): Allow passing NULL like free does.

The rule of least surprise.
This commit is contained in:
Werner Koch 2004-04-21 18:14:12 +00:00
parent 7eb7b24228
commit 37a4f44f06
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-04-21 Werner Koch <wk@gnupg.org>
* key.c (gpgme_key_unref): Allow passing NULL like free does.
The rule of least surprise.
2004-04-15 Werner Koch <wk@gnupg.org> 2004-04-15 Werner Koch <wk@gnupg.org>
* verify.c (prepare_new_sig, _gpgme_verify_status_handler): Remove * verify.c (prepare_new_sig, _gpgme_verify_status_handler): Remove

View File

@ -304,6 +304,9 @@ gpgme_key_unref (gpgme_key_t key)
gpgme_user_id_t uid; gpgme_user_id_t uid;
gpgme_subkey_t subkey; gpgme_subkey_t subkey;
if (!key)
return;
LOCK (key_ref_lock); LOCK (key_ref_lock);
assert (key->_refs > 0); assert (key->_refs > 0);
if (--key->_refs) if (--key->_refs)