Check allocate() return code.

This commit is contained in:
Frank Denis 2013-04-25 15:54:25 -07:00
parent 88c42e7daa
commit f0d71f9df0

View File

@ -34,7 +34,7 @@ allocate(void)
k2 = _sodium_alignedcalloc(&k2_, crypto_onetimeauth_KEYBYTES + k2 = _sodium_alignedcalloc(&k2_, crypto_onetimeauth_KEYBYTES +
crypto_onetimeauth_BYTES); crypto_onetimeauth_BYTES);
return !(h && m && k && h2 && m2 && k2); return -!(h && m && k && h2 && m2 && k2);
} }
static void static void
@ -143,7 +143,9 @@ crypto_onetimeauth_pick_best_implementation(void)
(implementations[i]) != 0) { (implementations[i]) != 0) {
continue; continue;
} }
allocate(); if (allocate() != 0) {
return NULL;
}
err = checksum_compute(); err = checksum_compute();
deallocate(); deallocate();
if (err == NULL && strcmp(checksum, CHECKSUM) == 0) { if (err == NULL && strcmp(checksum, CHECKSUM) == 0) {