diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2019-07-23 16:22:36 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2019-08-22 10:56:57 +0100 |
commit | 57b9f113fce2a2231a47e9295c1d461e9ff7f0f7 (patch) | |
tree | 5916f14bbe28782fe1da06544bfe9e58f6867e4d /crypto/tlscredspsk.c | |
parent | 133cf1e5b1a9a3cc6f1e47e5edad67d000259dd6 (diff) | |
download | qemu-57b9f113fce2a2231a47e9295c1d461e9ff7f0f7.zip qemu-57b9f113fce2a2231a47e9295c1d461e9ff7f0f7.tar.gz qemu-57b9f113fce2a2231a47e9295c1d461e9ff7f0f7.tar.bz2 |
crypto: use auto cleanup for many stack variables
Simplify cleanup paths by using glib's auto cleanup macros for stack
variables, allowing several goto jumps / labels to be eliminated.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/tlscredspsk.c')
-rw-r--r-- | crypto/tlscredspsk.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c index 4b6cf63..15d12e2 100644 --- a/crypto/tlscredspsk.c +++ b/crypto/tlscredspsk.c @@ -69,7 +69,8 @@ static int qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds, Error **errp) { - char *pskfile = NULL, *dhparams = NULL; + g_autofree char *pskfile = NULL; + g_autofree char *dhparams = NULL; const char *username; int ret; int rv = -1; @@ -139,8 +140,6 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds, rv = 0; cleanup: g_free(key.data); - g_free(pskfile); - g_free(dhparams); return rv; } |