qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Crypto: fix leak in ivgen essiv init
@ 2017-01-04  4:31 Li Qiang
  2017-01-04 10:25 ` Daniel P. Berrange
  0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2017-01-04  4:31 UTC (permalink / raw)
  To: berrange, qemu-devel; +Cc: liqiang6-s

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;
     }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Crypto: fix leak in ivgen essiv init
  2017-01-04  4:31 [Qemu-devel] [PATCH] Crypto: fix leak in ivgen essiv init Li Qiang
@ 2017-01-04 10:25 ` Daniel P. Berrange
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrange @ 2017-01-04 10:25 UTC (permalink / raw)
  To: Li Qiang; +Cc: qemu-devel, liqiang6-s

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
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-04 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04  4:31 [Qemu-devel] [PATCH] Crypto: fix leak in ivgen essiv init Li Qiang
2017-01-04 10:25 ` Daniel P. Berrange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).