]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - merge.c
cscvs to tla changeset 54
[onak.git] / merge.c
diff --git a/merge.c b/merge.c
index 69543378e283f78fef4af9ee898eda2c57c32695..7f1773eca706e8d0cfa4b7def3c83e54e78a24c3 100644 (file)
--- a/merge.c
+++ b/merge.c
@@ -10,9 +10,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "decodekey.h"
 #include "keydb.h"
 #include "keyid.h"
-#include "keyindex.h"
 #include "keystructs.h"
 #include "ll.h"
 #include "mem.h"
@@ -394,12 +394,15 @@ int update_keys(struct openpgp_publickey **keys, bool verbose)
                                        *keys = curkey->next;
                                } else {
                                        prev->next = curkey->next;
-                                       prev = curkey->next;
+                                       curkey->next = NULL;
+                                       free_publickey(curkey);
+                                       curkey = prev;
                                }
                        } else {
                                prev = curkey;
                                if (verbose) {
-                                       fprintf(stderr, "Merged key; storing updated key.\n");
+                                       fprintf(stderr,
+                                       "Merged key; storing updated key.\n");
                                }
                                store_key(oldkey, intrans, true);
                        }
@@ -407,7 +410,8 @@ int update_keys(struct openpgp_publickey **keys, bool verbose)
                        oldkey = NULL;
                } else {
                        if (verbose) {
-                               fprintf(stderr, "Storing completely new key.\n");
+                               fprintf(stderr,
+                                       "Storing completely new key.\n");
                        }
                        store_key(curkey, intrans, false);
                        newkeys++;