All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] rsa: Fix missing memory leak on error in fdt_add_bignum()
Date: Sat, 9 Jun 2018 21:50:42 +0200	[thread overview]
Message-ID: <e801d8b7-37c1-fbf0-adc6-c4dd0f7c7200@gmx.de> (raw)
In-Reply-To: <20180609182235.33532-7-sjg@chromium.org>

On 06/09/2018 08:22 PM, Simon Glass wrote:
> Thsi function can fail without freeing all its memory. Fix it.
> 
> Reported-by: Coverity (CID: 131217)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  lib/rsa/rsa-sign.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
> index d2788bf79a..2a09d2b19e 100644
> --- a/lib/rsa/rsa-sign.c
> +++ b/lib/rsa/rsa-sign.c
> @@ -667,15 +667,13 @@ static int fdt_add_bignum(void *blob, int noffset, const char *prop_name,
>  	 * might fail several times

Please, fix the memory leaks above this line too.

Best regards

Heinrich

>  	 */
>  	ret = fdt_setprop(blob, noffset, prop_name, buf, size);
> -	if (ret)
> -		return -FDT_ERR_NOSPACE;
>  	free(buf);
>  	BN_free(tmp);
>  	BN_free(big2);
>  	BN_free(big32);
>  	BN_free(big2_32);
>  
> -	return ret;
> +	return ret ? -FDT_ERR_NOSPACE : 0;
>  }
>  
>  int rsa_add_verify_data(struct image_sign_info *info, void *keydest)
> 

  reply	other threads:[~2018-06-09 19:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-09 18:22 [U-Boot] [PATCH 0/8] Fix some coverity warnings Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 1/8] log: Fix incorect range check in log_get_cat_name() Simon Glass
2018-06-09 19:28   ` Heinrich Schuchardt
2018-06-09 18:22 ` [U-Boot] [PATCH 2/8] console: Fix handling of NULL global_data Simon Glass
2018-06-09 19:32   ` Heinrich Schuchardt
2018-06-09 18:22 ` [U-Boot] [PATCH 3/8] sandbox: Use memcpy() to move overlapping regions Simon Glass
2018-06-09 18:56   ` Heinrich Schuchardt
2018-06-10 11:35     ` Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 4/8] fdtgrep: Fix logic of free() in do_fdtgrep() Simon Glass
2018-06-09 19:44   ` Heinrich Schuchardt
2018-06-12  6:05     ` Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 5/8] fdtgrep: Separate out checking of two allocations Simon Glass
2018-06-09 19:46   ` Heinrich Schuchardt
2018-06-12  6:05     ` Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 6/8] rsa: Fix missing memory leak on error in fdt_add_bignum() Simon Glass
2018-06-09 19:50   ` Heinrich Schuchardt [this message]
2018-06-12  6:05     ` Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 7/8] spi: sandbox: Fix memory leak in sandbox_sf_bind_emul() Simon Glass
2018-06-09 19:54   ` Heinrich Schuchardt
2018-06-10 11:35     ` Simon Glass
2018-06-12  6:05       ` Simon Glass
2018-06-09 18:22 ` [U-Boot] [PATCH 8/8] sandbox: swap_case: Increase number of base address regs Simon Glass
2018-06-09 19:58   ` Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e801d8b7-37c1-fbf0-adc6-c4dd0f7c7200@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.