diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2015-11-18 14:44:31 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2015-11-18 14:56:58 +0000 |
commit | 7b35030eedc26eff82210caa2b0fff2f9d0df453 (patch) | |
tree | 8dfac723a25df2ac0f9c85d3ad7b8e83e8c25ef7 /tests/crypto-tls-x509-helpers.c | |
parent | 6ef8cd7a4142049707b70b8278aaa9d8ee2bc5f5 (diff) | |
download | qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.zip qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.tar.gz qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.tar.bz2 |
crypto: fix leaks in TLS x509 helper functions
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 <berrange@redhat.com>
Diffstat (limited to 'tests/crypto-tls-x509-helpers.c')
-rw-r--r-- | tests/crypto-tls-x509-helpers.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); } |