We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 312247f commit eb75c89Copy full SHA for eb75c89
1 file changed
demos/hashsum.c
@@ -38,6 +38,11 @@
38
39
static char* hashsum;
40
41
+static void cleanup(void)
42
+{
43
+ free(hashsum);
44
+}
45
+
46
static void die(int status)
47
{
48
unsigned long w, x;
@@ -53,7 +58,6 @@ static void die(int status)
53
58
}
54
59
55
60
if (w != 0) fprintf(o, "\n");
56
- free(hashsum);
57
61
exit(status);
62
63
@@ -173,6 +177,7 @@ int main(int argc, char **argv)
173
177
unsigned char hash_buffer[MAXBLOCKSIZE];
174
178
175
179
hashsum = strdup(basename(argv[0]));
180
+ atexit(cleanup);
176
181
182
/* You need to register algorithms before using them */
183
register_all_ciphers();
0 commit comments