From 7ec342e125355db15bd028a72df3a01327b80cfb Mon Sep 17 00:00:00 2001 From: ndenoyelle Date: Thu, 10 Jan 2019 17:08:55 -0600 Subject: [PATCH] last changes correctingan error were not committed --- src/tleaf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tleaf.c b/src/tleaf.c index 6e5b38d..0649c9e 100644 --- a/src/tleaf.c +++ b/src/tleaf.c @@ -42,11 +42,10 @@ static void tleaf_it_free(excit_t it) static int tleaf_it_size(const excit_t it, ssize_t *size) { struct tleaf_it_s *data_it = it->data; - ssize_t i, s = 1; + int err = excit_size(data_it->levels, size); - for (i = 0; i < data_it->depth; i++) - s *= data_it->arities[i]; - *size = data_it->depth ? s : 0; + if (err != EXCIT_SUCCESS) + return err; return EXCIT_SUCCESS; } @@ -395,6 +394,12 @@ int tleaf_it_split(const excit_t it, const ssize_t depth, goto error_with_levels; for (i = 0; i < n; i++) { + out[i] = excit_alloc(EXCIT_TLEAF); + if (out == NULL) { + err = -EXCIT_ENOMEM; + goto error_with_levels_inverse; + } + err = tleaf_init_with_it(out[i], data_it->depth + 1, data_it->arities, -- 2.22.0