X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps_keypair.c;h=4dbd2ba1779f7f3d7c07f10e7ca0284b3f0d9f62;hb=1545909dcb3ac618754486f4ccd4d8f237d64bb7;hp=51a94eeb458723483c38fd55263a790914177488;hpb=1c475ecb575367a6b3f9328b0f643ad636155341;p=tinc diff --git a/src/sptps_keypair.c b/src/sptps_keypair.c index 51a94eeb..4dbd2ba1 100644 --- a/src/sptps_keypair.c +++ b/src/sptps_keypair.c @@ -23,7 +23,6 @@ #include "crypto.h" #include "ecdsagen.h" -#include "utils.h" static char *program_name; @@ -97,12 +96,14 @@ int main(int argc, char *argv[]) { if(fp) { if(!ecdsa_write_pem_private_key(key, fp)) { fprintf(stderr, "Could not write ECDSA private key\n"); + free(key); return 1; } fclose(fp); } else { fprintf(stderr, "Could not open '%s' for writing: %s\n", argv[1], strerror(errno)); + free(key); return 1; } @@ -113,11 +114,12 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Could not write ECDSA public key\n"); } + free(key); fclose(fp); + return 0; } else { fprintf(stderr, "Could not open '%s' for writing: %s\n", argv[2], strerror(errno)); + free(key); return 1; } - - return 0; }