diff options
author | Daniel P. Berrange | 2015-11-18 15:44:31 +0100 |
---|---|---|
committer | Daniel P. Berrange | 2015-11-18 15:56:58 +0100 |
commit | 7b35030eedc26eff82210caa2b0fff2f9d0df453 (patch) | |
tree | 8dfac723a25df2ac0f9c85d3ad7b8e83e8c25ef7 /tests | |
parent | crypto: fix mistaken setting of Error in success code path (diff) | |
download | qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.tar.gz qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.tar.xz qemu-7b35030eedc26eff82210caa2b0fff2f9d0df453.zip |
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')
-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 c5de67baaf..47b4c7ba53 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); } |