Skip to contentSkip to conversation

Crypto: fix leak in ivgen essiv init

PATCH In review Li Qiang 2 participants 2 messages Jan 4, 2017 Crypto API

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 Crypto: fix leak in ivgen essiv init

From: Li Qiang <[email protected]>

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

---
 crypto/ivgen-essiv.c | 1 +
 1 file changed, 1 insertion(+)
crypto/ivgen-essiv.c +1 -0
index 634de63..cba20bd 100644
@@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
                            &salt, &nhash,
                            errp) < 0) {
         g_free(essiv);
+        g_free(salt);
         return -1;
     }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 15 lines · Li Qiang

From: Li Qiang <[email protected]>

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

---
 crypto/ivgen-essiv.c | 1 +
 1 file changed, 1 insertion(+)
crypto/ivgen-essiv.c +0 -0
index 634de63..cba20bd 100644

crypto/ivgen-essiv.c static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen, · line 53

Quoted 6 lines
crypto/ivgen-essiv.c +1 -0
@@ -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

Signature · 3 lines
|: 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/ :|