From 57b9f113fce2a2231a47e9295c1d461e9ff7f0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 23 Jul 2019 16:22:36 +0100 Subject: crypto: use auto cleanup for many stack variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Stefan Hajnoczi Signed-off-by: Daniel P. Berrangé --- crypto/tlscredspsk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crypto/tlscredspsk.c') diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c index 4b6cf636ce..15d12e2448 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; } -- cgit v1.2.3