From: Guus Sliepen Date: Fri, 6 Oct 2017 19:40:03 +0000 (+0200) Subject: Fix a few minor memory leaks. X-Git-Tag: release-1.0.33~23 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=0965a24388b328ea7b5ea287f8629d4cb5ac9a90;p=tinc Fix a few minor memory leaks. --- diff --git a/src/tincd.c b/src/tincd.c index 84ce0d45..98a9a64f 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -413,6 +413,7 @@ static bool keygen(int bits) { if(!result) { fprintf(stderr, "Error during key generation!\n"); + RSA_free(rsa_key); return false; } else fprintf(stderr, "Done.\n"); @@ -420,8 +421,10 @@ static bool keygen(int bits) { snprintf(filename, sizeof filename, "%s/rsa_key.priv", confbase); f = ask_and_open(filename, "private RSA key"); - if(!f) + if(!f) { + RSA_free(rsa_key); return false; + } #ifdef HAVE_FCHMOD /* Make it unreadable for others. */ @@ -443,13 +446,17 @@ static bool keygen(int bits) { f = ask_and_open(filename, "public RSA key"); - if(!f) + if(!f) { + RSA_free(rsa_key); return false; + } fputc('\n', f); PEM_write_RSAPublicKey(f, rsa_key); fclose(f); + RSA_free(rsa_key); + return true; } @@ -737,7 +744,7 @@ end: ERR_free_strings(); exit_configuration(&config_tree); - list_free(cmdline_conf); + list_delete_list(cmdline_conf); free_names(); return status;