diff options
| author | Mosder <xmosder12@gmail.com> | 2026-07-23 17:35:04 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-07-23 17:35:04 +0200 |
| commit | 8317c3b33b9b1c70e5ae4c87c7efe33d9b9ce09a (patch) | |
| tree | 8a6b5e20196a253c75b44762de223f1ea2b4a067 /analyzer/parser/structs.c | |
| parent | 33fcaa8140784ab32cfc8c14a6fc7fdb71435265 (diff) | |
feat: added helper functions for dealing with memory management and refactored the codebase to use them
Diffstat (limited to 'analyzer/parser/structs.c')
| -rw-r--r-- | analyzer/parser/structs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/analyzer/parser/structs.c b/analyzer/parser/structs.c index c59fa82..dedf0d1 100644 --- a/analyzer/parser/structs.c +++ b/analyzer/parser/structs.c @@ -4,12 +4,14 @@ #include <stdlib.h> #include <string.h> +#include "utils/memory.h" + void fill_struct(void *obj, const StructField *fields, size_t n_fields, const char *data, size_t data_len, const char *sep) { for (size_t i = 0; i < n_fields; i++) { char *next_sep = memmem(data, data_len, sep, strlen(sep)); size_t len = next_sep ? next_sep - data : data_len; - char *str = malloc(len + 1); + char *str = safe_malloc(len + 1); memcpy(str, data, len); str[len] = '\0'; |
