diff options
author | David Phillips <david@sighup.nz> | 2017-05-29 11:03:36 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-05-29 11:03:36 +1200 |
commit | 8a8fc0619c0faaa1767346e2a474322772bbae4d (patch) | |
tree | 7d6eb7f12422008fca49badd746f63d9bec8a252 /sand-leek.c | |
parent | 66d2e147b34a06a8de72ba7ff17f9991bfe2addd (diff) | |
download | sand-leek-8a8fc0619c0faaa1767346e2a474322772bbae4d.tar.xz |
Free alloced objects, move volatile to start of decl
Diffstat (limited to 'sand-leek.c')
-rw-r--r-- | sand-leek.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sand-leek.c b/sand-leek.c index 7f94126..f4bf1ae 100644 --- a/sand-leek.c +++ b/sand-leek.c @@ -246,7 +246,7 @@ main(int argc, char **argv) { int i = 0; ssize_t offset = 0; pthread_t *workers = NULL; - unsigned long volatile *khashes = NULL; + volatile unsigned long *khashes = NULL; while ((opt = getopt(argc, argv, "t:s:V")) != -1) { switch (opt) { @@ -309,6 +309,8 @@ main(int argc, char **argv) { for (i = 0; i < thread_count; i++) { if (pthread_create(&workers[i], NULL, work, (void*)&khashes[i])) { perror("pthread_create"); + free((unsigned long*)khashes); + free(workers); return 1; } } @@ -319,6 +321,8 @@ main(int argc, char **argv) { pthread_join(workers[i], NULL); } + free((unsigned long*)khashes); + free(workers); return 0; } |