}
prefix = strbuf_steal(&buf);
} else
- prefix = NOFAIL(strdup(""));
+ prefix = strdup("");
+
+ if (prefix == NULL)
+ goto err;
if (offset & INDEX_NODE_CHILDS) {
int first = read_char(in);
child_count = last - first + 1;
- node = NOFAIL(malloc(sizeof(struct index_node_f) +
- sizeof(uint32_t) * child_count));
+ node = malloc(sizeof(struct index_node_f) +
+ sizeof(uint32_t) * child_count);
+ if (node == NULL)
+ goto err;
node->first = (unsigned char) first;
node->last = (unsigned char) last;
if (read_long(in, &node->children[i]) < 0)
goto err;
} else {
- node = NOFAIL(malloc(sizeof(struct index_node_f)));
+ node = malloc(sizeof(struct index_node_f));
+ if (node == NULL)
+ goto err;
+
node->first = INDEX_CHILDMAX;
node->last = 0;
}
version >> 16 != INDEX_VERSION_MAJOR)
goto err;
- new = NOFAIL(malloc(sizeof(struct index_file)));
+ new = malloc(sizeof(struct index_file));
+ if (new == NULL)
+ goto err;
+
new->file = file;
if (read_long(new->file, &new->root_offset) < 0)
goto err;