diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-11-30 11:56:14 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2021-01-29 17:07:53 +0000 |
commit | ab366aae78bcac972a0920ffdda3136fc13fa093 (patch) | |
tree | d047381b8fe8f2b1bdf823b3aa4f604e75e91029 /crypto/tlscredsanon.c | |
parent | 668cb74b2af1129349a6c41763bc88d801161e09 (diff) | |
download | qemu-ab366aae78bcac972a0920ffdda3136fc13fa093.zip qemu-ab366aae78bcac972a0920ffdda3136fc13fa093.tar.gz qemu-ab366aae78bcac972a0920ffdda3136fc13fa093.tar.bz2 |
crypto: Fix memory leaks in set_loaded for tls-*
If you set the loaded property to true when it was already true, the
state is overwritten without freeing the old state first. Change the
set_loaded callback so that it always frees the old state (which is a
no-op if nothing was loaded) and only then load if requestsd.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/tlscredsanon.c')
-rw-r--r-- | crypto/tlscredsanon.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c index 30275b6..bea5f76 100644 --- a/crypto/tlscredsanon.c +++ b/crypto/tlscredsanon.c @@ -123,10 +123,9 @@ qcrypto_tls_creds_anon_prop_set_loaded(Object *obj, { QCryptoTLSCredsAnon *creds = QCRYPTO_TLS_CREDS_ANON(obj); + qcrypto_tls_creds_anon_unload(creds); if (value) { qcrypto_tls_creds_anon_load(creds, errp); - } else { - qcrypto_tls_creds_anon_unload(creds); } } |