Add missing sodium_free() calls in the kdf test

This commit is contained in:
Frank Denis 2017-12-16 14:31:01 +01:00
parent 99fe302562
commit b84e4b9ddf

View File

@ -13,8 +13,9 @@ tv_kdf(void)
int ret;
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
memcpy(context, "KDF test", strlen("KDF test"));
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
memcpy(context, "KDF test", strlen("KDF test"));
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
master_key[i] = i;
}
@ -41,6 +42,9 @@ tv_kdf(void)
sodium_free(subkey);
}
sodium_free(master_key);
sodium_free(context);
assert(strcmp(crypto_kdf_primitive(), crypto_kdf_PRIMITIVE) == 0);
assert(crypto_kdf_BYTES_MAX > 0);
assert(crypto_kdf_BYTES_MIN <= crypto_kdf_BYTES_MAX);