From: Kirill Isakov Date: Sun, 17 Apr 2022 19:37:38 +0000 (+0600) Subject: Fix resource leaks found by GCC -fanalyzer X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=b39b69a2e4b20c8fb9c49af4156734437b42f910;p=tinc Fix resource leaks found by GCC -fanalyzer --- diff --git a/src/keys.c b/src/keys.c index ac99ac40..84bd0719 100644 --- a/src/keys.c +++ b/src/keys.c @@ -134,6 +134,7 @@ ecdsa_t *read_ecdsa_private_key(splay_tree_t *config_tree, char **keyfile) { if(fstat(fileno(fp), &s)) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not stat Ed25519 private key file `%s': %s'", fname, strerror(errno)); free(fname); + fclose(fp); return false; } @@ -268,6 +269,7 @@ rsa_t *read_rsa_private_key(splay_tree_t *config_tree, char **keyfile) { if(fstat(fileno(fp), &s)) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not stat RSA private key file `%s': %s'", fname, strerror(errno)); free(fname); + fclose(fp); return NULL; } diff --git a/src/multicast_device.c b/src/multicast_device.c index 79239a19..3dba7f79 100644 --- a/src/multicast_device.c +++ b/src/multicast_device.c @@ -144,6 +144,7 @@ static bool setup_device(void) { logger(DEBUG_ALWAYS, LOG_INFO, "%s is a %s", device, device_info); + free(host); return true; error: