Allow null keys to be referenced (a no-op) for simpler "copying" of
authorGreg Hudson <ghudson@mit.edu>
Fri, 27 Nov 2009 21:15:53 +0000 (21:15 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 27 Nov 2009 21:15:53 +0000 (21:15 +0000)
keys which might or might not exist.  Consistent with allowing freeing
of null keys.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23371 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/krb/key.c

index 43d9ce6320c193a0206fa817846e1e411d690782..15c6205fbf6333d55c156430181df04d61cd3288 100644 (file)
@@ -62,7 +62,8 @@ cleanup:
 void KRB5_CALLCONV
 krb5_k_reference_key(krb5_context context, krb5_key key)
 {
-    key->refcount++;
+    if (key)
+       key->refcount++;
 }
 
 /* Free the memory used by a krb5_key. */