diff mbox series

Free pointer before exiting on error

Message ID 20231231051007.145823-1-m.belouarga@technologyandstrategy.com
State Accepted
Headers show
Series Free pointer before exiting on error | expand

Commit Message

Mohamed Belouarga Dec. 31, 2023, 5:10 a.m. UTC
From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>

When an error happend and the function cannot return the pointer dgst,
free it before quitting the function

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
---
 corelib/swupdate_decrypt_pkcs11.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefano Babic Jan. 12, 2024, 3:05 p.m. UTC | #1
Hi Mohamed,

On 31.12.23 06:10, belouargamohamed@gmail.com wrote:
> From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
> 
> When an error happend and the function cannot return the pointer dgst,
> free it before quitting the function
> 
> Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
> ---
>   corelib/swupdate_decrypt_pkcs11.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/corelib/swupdate_decrypt_pkcs11.c b/corelib/swupdate_decrypt_pkcs11.c
> index 63672c5..b16d59e 100644
> --- a/corelib/swupdate_decrypt_pkcs11.c
> +++ b/corelib/swupdate_decrypt_pkcs11.c
> @@ -49,6 +49,7 @@ struct swupdate_digest *swupdate_DECRYPT_init(unsigned char *uri,
>   	if (err) {
>   		msg = p11_kit_uri_message(err);
>   		ERROR("PKCS#11 URI: %s", msg);
> +		free(dgst);
>   		return NULL;
>   	}
>   

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/swupdate_decrypt_pkcs11.c b/corelib/swupdate_decrypt_pkcs11.c
index 63672c5..b16d59e 100644
--- a/corelib/swupdate_decrypt_pkcs11.c
+++ b/corelib/swupdate_decrypt_pkcs11.c
@@ -49,6 +49,7 @@  struct swupdate_digest *swupdate_DECRYPT_init(unsigned char *uri,
 	if (err) {
 		msg = p11_kit_uri_message(err);
 		ERROR("PKCS#11 URI: %s", msg);
+		free(dgst);
 		return NULL;
 	}