diff options
author | sanine <sanine.not@pm.me> | 2023-02-04 13:04:26 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-04 13:04:26 -0600 |
commit | 5c81c2d2eef132923a75da05efef160adcf95c86 (patch) | |
tree | 455a2b75582cd4c8e9f815f0a3adeb24799507d0 /src/geometry | |
parent | ef5142f0d044b3480790606536c492719c6e73ef (diff) |
use kai_alloc instead of malloc
Diffstat (limited to 'src/geometry')
-rw-r--r-- | src/geometry/geometry.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/geometry/geometry.c b/src/geometry/geometry.c index 6c84b11..c3eb40c 100644 --- a/src/geometry/geometry.c +++ b/src/geometry/geometry.c @@ -29,7 +29,14 @@ int kai_read_float_array(struct ka_float_array_t *dest, struct kai_tag_t *src) dest->magnitude = kai_tag_attr_to_long(src, "magnitude", 38); /* allocate & fill buffer */ - dest->buf = malloc(dest->count * sizeof(ka_real_t)); + dest->buf = kai_alloc( + dest->count * sizeof(ka_real_t), + "float_array buffer" + ); + if (dest->buf == NULL) { + free(dest->id); + return -1; + } kai_text_to_reals(dest->buf, src->content, dest->count); return 0; @@ -69,7 +76,14 @@ int kai_read_accessor(struct ka_accessor_t *dest, struct kai_tag_t *src) dest->stride = kai_tag_attr_to_long(src, "stride", 1); dest->param_count = kai_tag_num_children(src); - dest->param = malloc(dest->param_count * sizeof(struct ka_param_t)); + dest->param = kai_alloc( + dest->param_count * sizeof(struct ka_param_t), + "accessor tag param array" + ); + if (dest->param == NULL) { + free(source); + return -1; + } struct kai_tag_t *t = src->children; int i; for (i=0; i<dest->param_count; i++) { |