- rb_parents = para_malloc(t->num_rbtrees * sizeof(struct rn_node*));
- rb_links = para_malloc(t->num_rbtrees * sizeof(struct rn_node**));
- if (t->num_mapped_columns)
- new_row_index = para_malloc(t->row_index_size);
+ rb_parents = malloc(t->num_rbtrees * sizeof(struct rn_node*));
+ if (!rb_parents)
+ return -ERRNO_TO_ERROR(ENOMEM);
+ rb_links = malloc(t->num_rbtrees * sizeof(struct rn_node**));
+ if (!rb_links) {
+ free(rb_parents);
+ return -ERRNO_TO_ERROR(ENOMEM);
+ }
+ if (t->num_mapped_columns) {
+ new_row_index = malloc(t->row_index_size);
+ if (!new_row_index) {
+ free(rb_links);
+ free(rb_parents);
+ return -ERRNO_TO_ERROR(ENOMEM);
+ }
+ }