From ecbceac3414bf851d166e8ce7dceaf1dae12bb08 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sun, 9 Feb 2014 00:59:03 -0500 Subject: Fixed memory leaks and removed repeated code --- other/fun/sign.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'other/fun/sign.c') diff --git a/other/fun/sign.c b/other/fun/sign.c index 423d974a..eaea9d6a 100644 --- a/other/fun/sign.c +++ b/other/fun/sign.c @@ -17,19 +17,7 @@ */ #include #include - -unsigned char *hex_string_to_bin(char hex_string[]) -{ - size_t len = strlen(hex_string); - unsigned char *val = malloc(len); - char *pos = hex_string; - int i; - - for (i = 0; i < len; ++i, pos += 2) - sscanf(pos, "%2hhx", &val[i]); - - return val; -} +#include "../../testing/misc_tools.c" // hex_string_to_bin int load_file(char *filename, char **result) { @@ -90,6 +78,7 @@ int main(int argc, char *argv[]) unsigned long long smlen; char *sm = malloc(size + crypto_sign_ed25519_BYTES * 2); crypto_sign_ed25519(sm, &smlen, data, size, secret_key); + free(secret_key); if (smlen - size != crypto_sign_ed25519_BYTES) goto fail; -- cgit v1.2.3