key/key-io.c (key_new): Don't leak attribute `sym_table' on error.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 8 Oct 2019 10:36:34 +0000 (11:36 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 8 Oct 2019 10:37:55 +0000 (11:37 +0100)
This is safe: `insert' doesn't do anything with `k->a'.

key/key-io.c

index c79c8e0..15bebdc 100644 (file)
@@ -552,12 +552,12 @@ int key_new(key_file *f, uint32 id, const char *type, time_t exp, key **kk)
     k->exp = k->del = exp;
     k->c = 0;
     k->type = (char *)type; /* temporarily */
-    sym_create(&k->a);
     if ((e = insert(f, k)) != 0)
       DESTROY(k);
     else {
       k->k = key_newstring(KCAT_SHARE, "<unset>");
       k->type = xstrdup(type);
+      sym_create(&k->a);
       *kk = k;
       f->f |= KF_MODIFIED;
     }