Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/catacomb
[u/mdw/catacomb] / key-attr.c
index ceec2ae..b6a3616 100644 (file)
@@ -194,8 +194,8 @@ int key_setkeydata(key_file *kf, key *k, key_data *kd)
 {
   if (!(kf->f & KF_WRITE))
     return (KERR_READONLY);
-  key_drop(k->k);
   key_incref(kd);
+  key_drop(k->k);
   k->k = kd;
   kf->f |= KF_MODIFIED;
   return (0);