This patch adds a null pointer check and explicitly frees memory in the
tcrypt.c function test_ahash_speed.
Signed-off-by: Winston Hudson <b45308@stc-mongo.am.freescale.net>
char *output = kmalloc(output_size, GFP_KERNEL);
int i, ret;
+ if (!output) {
+ printk(KERN_INFO "\nUnable to allocate output buffer memory\n");
+ return;
+ }
+
printk(KERN_INFO "\ntesting speed of async %s\n", algo);
tfm = crypto_alloc_ahash(algo, 0, 0);
if (IS_ERR(tfm)) {
pr_err("failed to load transform for %s: %ld\n",
algo, PTR_ERR(tfm));
+ kfree(output);
return;
}
ahash_request_free(req);
out:
+ kfree(output);
crypto_free_ahash(tfm);
}