(gpgme_key_unref): Allow passing NULL like free does.
authorWerner Koch <wk@gnupg.org>
Wed, 21 Apr 2004 18:14:12 +0000 (18:14 +0000)
committerWerner Koch <wk@gnupg.org>
Wed, 21 Apr 2004 18:14:12 +0000 (18:14 +0000)
The rule of least surprise.

gpgme/ChangeLog
gpgme/key.c

index 1abc055a819b0900529be25c20c0b85cf8955a59..3192ad0115510e70561dfeea5dc80680474c9ad1 100644 (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>
 
        * verify.c (prepare_new_sig, _gpgme_verify_status_handler): Remove
index 05beb114739c0609b4f49d7a7425dc84dd170ce3..4634c2646bb57dca7f901637f048113372c0af34 100644 (file)
@@ -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)