diff mbox

Crypto: fix leak in ivgen essiv init

Message ID 586c7aad.0834c80a.d7aff.122e@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Qiang Jan. 4, 2017, 4:31 a.m. UTC
From: Li Qiang <liqiang6-s@360.cn>

On error path, the 'salt' doesn't been freed thus leading
a memory leak. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 crypto/ivgen-essiv.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel P. Berrangé Jan. 4, 2017, 10:25 a.m. UTC | #1
On Tue, Jan 03, 2017 at 08:31:34PM -0800, Li Qiang wrote:
> From: Li Qiang <liqiang6-s@360.cn>
> 
> On error path, the 'salt' doesn't been freed thus leading
> a memory leak. This patch avoid this.
> 
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---
>  crypto/ivgen-essiv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c
> index 634de63..cba20bd 100644
> --- a/crypto/ivgen-essiv.c
> +++ b/crypto/ivgen-essiv.c
> @@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
>                             &salt, &nhash,
>                             errp) < 0) {
>          g_free(essiv);
> +        g_free(salt);
>          return -1;
>      }

Looks good, thanks, added to the crypto-next queue.

Regards,
Daniel
diff mbox

Patch

diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c
index 634de63..cba20bd 100644
--- a/crypto/ivgen-essiv.c
+++ b/crypto/ivgen-essiv.c
@@ -48,6 +48,7 @@  static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
                            &salt, &nhash,
                            errp) < 0) {
         g_free(essiv);
+        g_free(salt);
         return -1;
     }