Commit 8d1d5d6d authored by Niels Möller's avatar Niels Möller

nettle-hash.c: Use stack allocation for the small hex output buffer.

parent 8fc5dff5
2013-06-25 Niels Möller <nisse@lysator.liu.se>
* tools/nettle-hash.c (digest_file): Use stack allocation for the
small hex output buffer.
* examples/io.c (MIN): Deleted unused macro.
2013-05-21 Niels Möller <nisse@lysator.liu.se>
......
......@@ -108,7 +108,7 @@ digest_file(const struct nettle_hash *alg,
else
{
unsigned i;
char *hex = xalloc(BASE16_ENCODE_LENGTH(8) + 1);
char hex[BASE16_ENCODE_LENGTH(8) + 1];
for (i = 0; i + 8 < digest_length; i += 8)
{
base16_encode_update(hex, 8, digest + i);
......@@ -118,7 +118,6 @@ digest_file(const struct nettle_hash *alg,
base16_encode_update(hex, digest_length - i, digest + i);
hex[BASE16_ENCODE_LENGTH(digest_length - i)] = 0;
printf("%s %s\n", hex, alg->name);
free(hex);
}
free(digest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment