summaryrefslogtreecommitdiff
path: root/src/geometry/geometry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry/geometry.c')
-rw-r--r--src/geometry/geometry.c18
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++) {