aboutsummaryrefslogtreecommitdiff
path: root/crypto/tlscredspsk.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2019-07-23 16:22:36 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2019-08-22 10:56:57 +0100
commit57b9f113fce2a2231a47e9295c1d461e9ff7f0f7 (patch)
tree5916f14bbe28782fe1da06544bfe9e58f6867e4d /crypto/tlscredspsk.c
parent133cf1e5b1a9a3cc6f1e47e5edad67d000259dd6 (diff)
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.c5
1 files changed, 2 insertions, 3 deletions
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;
}