disk/AFsplitter: check argument validity before doing any allocs.

This avoids possible memory leaks.

Found by: Coverity scan.
This commit is contained in:
Vladimir Serbinenko 2015-01-24 21:33:30 +01:00
parent 3b1b39c082
commit 7d97335942
1 changed files with 3 additions and 3 deletions

View File

@ -72,13 +72,13 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst,
grub_size_t i;
grub_uint8_t *bufblock;
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0)
return GPG_ERR_INV_ARG;
bufblock = grub_zalloc (blocksize);
if (bufblock == NULL)
return GPG_ERR_OUT_OF_MEMORY;
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0)
return GPG_ERR_INV_ARG;
grub_memset (bufblock, 0, blocksize);
for (i = 0; i < blocknumbers - 1; i++)
{