[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v1 (for 2.5) 3/4] crypto: fix leaks in TLS x509 helpe
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PULL v1 (for 2.5) 3/4] crypto: fix leaks in TLS x509 helper functions |
Date: |
Wed, 18 Nov 2015 15:47:43 +0000 |
The test_tls_get_ipaddr() method forgot to free the returned data
from getaddrinfo().
The test_tls_write_cert_chain() method forgot to free the allocated
buffer holding the certificate data after writing it out to a file.
Signed-off-by: Daniel P. Berrange <address@hidden>
---
tests/crypto-tls-x509-helpers.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c
index c5de67b..47b4c7b 100644
--- a/tests/crypto-tls-x509-helpers.c
+++ b/tests/crypto-tls-x509-helpers.c
@@ -153,6 +153,7 @@ test_tls_get_ipaddr(const char *addrstr,
*datalen = res->ai_addrlen;
*data = g_new(char, *datalen);
memcpy(*data, res->ai_addr, *datalen);
+ freeaddrinfo(res);
}
/*
@@ -465,6 +466,7 @@ void test_tls_write_cert_chain(const char *filename,
if (!g_file_set_contents(filename, buffer, offset, NULL)) {
abort();
}
+ g_free(buffer);
}
--
2.5.0