]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - keydb_db2.c
cscvs to tla changeset 59
[onak.git] / keydb_db2.c
index 1303cd80824312d48f1f628a93056040199331b6..0c597c4b1b1e00584db0c6ebdf7ee50f370ac178 100644 (file)
@@ -21,6 +21,7 @@
 #include "keyid.h"
 #include "keyindex.h"
 #include "keystructs.h"
 #include "keyid.h"
 #include "keyindex.h"
 #include "keystructs.h"
+#include "log.h"
 #include "mem.h"
 #include "onak-conf.h"
 #include "parsekey.h"
 #include "mem.h"
 #include "onak-conf.h"
 #include "parsekey.h"
@@ -91,13 +92,15 @@ void initdb(void)
                                        &db2_env, &keydbinfo,
                                        &db2_keydbfiles[i]);
                        if (ret) {
                                        &db2_env, &keydbinfo,
                                        &db2_keydbfiles[i]);
                        if (ret) {
-                               fprintf(stderr, "Error opening db file %d (errno %d)\n",
+                               logthing(LOGTHING_CRITICAL,
+                                       "Error opening db file %d (errno %d)",
                                        i, ret);
                                exit(1);
                        }
                }
        } else {
                                        i, ret);
                                exit(1);
                        }
                }
        } else {
-               fprintf(stderr, "Error initializing db (%d).\n", ret);
+               logthing(LOGTHING_CRITICAL, "Error initializing db (%d).",
+                               ret);
                exit(1);
        }
 }
                exit(1);
        }
 }
@@ -183,6 +186,8 @@ int fetch_key(uint64_t keyid, struct openpgp_publickey **publickey,
                fetchbuf.size = data.size;
                read_openpgp_stream(buffer_fetchchar, &fetchbuf, &packets);
                parse_keys(packets, publickey);
                fetchbuf.size = data.size;
                read_openpgp_stream(buffer_fetchchar, &fetchbuf, &packets);
                parse_keys(packets, publickey);
+               free_packet_list(packets);
+               packets = NULL;
        }
 
        return (!ret);
        }
 
        return (!ret);