summaryrefslogtreecommitdiffstats
path: root/test/test_filesystem.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-11-15 14:27:37 -0500
committerDavid Robillard <d@drobilla.net>2024-11-15 14:27:52 -0500
commite58b18dbcea3646ac9ec8b0d96f54c1111819d59 (patch)
tree096b10fbba662a320012cb57e060f91b5762b1eb /test/test_filesystem.c
parent69081b4c2a78c2eeaa816ade57ff9fffcd96e564 (diff)
downloadzix-e58b18dbcea3646ac9ec8b0d96f54c1111819d59.tar.gz
zix-e58b18dbcea3646ac9ec8b0d96f54c1111819d59.tar.bz2
zix-e58b18dbcea3646ac9ec8b0d96f54c1111819d59.zip
Assert that allocation and file opening succeeds in tests
This appeases GCC's static analyzer.
Diffstat (limited to 'test/test_filesystem.c')
-rw-r--r--test/test_filesystem.c2
1 files changed, 2 insertions, 0 deletions
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;