Commit 6b11c017 authored by Geoff Simmons's avatar Geoff Simmons

Bugfix a memory leak.

parent bfc395da
......@@ -260,6 +260,8 @@ KEY_Fini(void)
CHECK_OBJ(key, KEY_MAGIC);
AN(key->key);
KEY_Wipe(key->key);
AN(key->id);
free(key->id);
nxt_k = VRBT_NEXT(key_tree, tree_h, key);
VRBT_REMOVE(key_tree, tree_h, key);
FREE_OBJ(key);
......@@ -324,6 +326,10 @@ key_find(struct key_tree *tree_h, uint8_t *id, uint8_t idlen)
keycmp.idlen = idlen;
key = VRBT_FIND(key_tree, tree_h, &keycmp);
CHECK_OBJ_ORNULL(key, KEY_MAGIC);
if (key != NULL) {
AN(key->key);
AN(key->id);
}
return (key);
}
......@@ -390,6 +396,7 @@ KEY_Set(VRT_CTX, uint8_t *id, uint8_t idlen, const uint8_t *key)
VRBT_INSERT(key_tree, tree_h, k);
}
CHECK_OBJ_NOTNULL(k, KEY_MAGIC);
AN(k->key);
memcpy(k->key, key, AES128_KEYLEN);
KEY_Unlock(idlen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment