diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:43:54 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:43:54 -0500 |
commit | b08f9607a5c9cf0e3cccf3d64b6e4f7b47b71a3a (patch) | |
tree | 1ec4f80d145d355568eee876ee9875d7499c11ec | |
parent | 22340f375f248d087e64016c097a489556ec79ce (diff) | |
download | stasis-b08f9607a5c9cf0e3cccf3d64b6e4f7b47b71a3a.tar.gz |
Free result on error in stasis_testing_read_ascii
-rw-r--r-- | tests/include/testing.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/include/testing.h b/tests/include/testing.h index 5ff847b..ab24115 100644 --- a/tests/include/testing.h +++ b/tests/include/testing.h @@ -92,9 +92,10 @@ inline char *stasis_testing_read_ascii(const char *filename) { return NULL; } - char *result; + char *result = NULL; result = calloc(st.st_size + 1, sizeof(*result)); if (fread(result, sizeof(*result), st.st_size, fp) < 1) { + guard_free(result); perror(filename); fclose(fp); return NULL; |