X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps_keypair.c;h=51540aa5f9655b180aea35b258f6bd9d83e89ace;hb=7208397398f7e08d741bfa83594a88e5d01b6220;hp=51a94eeb458723483c38fd55263a790914177488;hpb=1c475ecb575367a6b3f9328b0f643ad636155341;p=tinc diff --git a/src/sptps_keypair.c b/src/sptps_keypair.c index 51a94eeb..51540aa5 100644 --- a/src/sptps_keypair.c +++ b/src/sptps_keypair.c @@ -97,12 +97,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 +115,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; }