diff options
-rw-r--r-- | benchmark/dict_bench.c | 3 | ||||
-rw-r--r-- | benchmark/tree_bench.c | 6 | ||||
-rw-r--r-- | test/test_filesystem.c | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/benchmark/dict_bench.c b/benchmark/dict_bench.c index 5d9acd0..6cb247a 100644 --- a/benchmark/dict_bench.c +++ b/benchmark/dict_bench.c @@ -92,6 +92,7 @@ read_inputs(FILE* const fd) inputs.chunks = new_chunks; inputs.chunks[inputs.n_chunks].buf = (char*)malloc(buf_len); inputs.chunks[inputs.n_chunks].len = this_str_len; + assert(inputs.chunks[inputs.n_chunks].buf); memcpy(inputs.chunks[inputs.n_chunks].buf, inputs.buf, buf_len); this_str_len = 0; if (++inputs.n_chunks == max_n_strings) { @@ -128,6 +129,8 @@ run(FILE* const fd) FILE* insert_dat = fopen("dict_insert.txt", "w"); FILE* search_dat = fopen("dict_search.txt", "w"); + assert(insert_dat); + assert(search_dat); fprintf(insert_dat, "# n\tGHashTable\tZixHash\n"); fprintf(search_dat, "# n\tGHashTable\tZixHash\n"); diff --git a/benchmark/tree_bench.c b/benchmark/tree_bench.c index 8cc2711..2c8f896 100644 --- a/benchmark/tree_bench.c +++ b/benchmark/tree_bench.c @@ -15,6 +15,7 @@ ZIX_DISABLE_GLIB_WARNINGS #include <glib.h> ZIX_RESTORE_WARNINGS +#include <assert.h> #include <inttypes.h> #include <stdbool.h> #include <stdio.h> @@ -281,6 +282,11 @@ main(int argc, char** argv) FILE* search_dat = fopen("tree_search.txt", "w"); FILE* iter_dat = fopen("tree_iterate.txt", "w"); FILE* del_dat = fopen("tree_delete.txt", "w"); + assert(insert_dat); + assert(search_dat); + assert(iter_dat); + assert(del_dat); + fprintf(insert_dat, HEADER); fprintf(search_dat, HEADER); fprintf(iter_dat, HEADER); diff --git a/test/test_filesystem.c b/test/test_filesystem.c index e6180fb..9fd6007 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -161,6 +161,7 @@ test_file_type(void) if (sock >= 0) { const socklen_t addr_len = sizeof(struct sockaddr_un); struct sockaddr_un* const addr = (struct sockaddr_un*)calloc(1, addr_len); + assert(addr); if (strlen(file_path) < sizeof(addr->sun_path)) { addr->sun_family = AF_UNIX; @@ -393,6 +394,7 @@ visit(const char* const path, const char* const name, void* const data) if (new_names) { char* const name_copy = (char*)calloc(name_len + 1, 1); + assert(name_copy); memcpy(name_copy, name, name_len + 1); file_list->names = new_names; |