In cf_read_generic(), the parse result had not been checked to not be
NULL, which caused a segfault when trying to access any of its members.
Now, an error will be returned in that case.
Also, cf_ci_append_children() has been made more robust in that respect.
It now detects an empty source and does nothing in that case.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
{
oconfig_item_t *temp;
+ if ((src == NULL) || (src->children_num == 0))
+ return (0);
+
temp = (oconfig_item_t *) realloc (dst->children,
sizeof (oconfig_item_t)
* (dst->children_num + src->children_num));
continue;
}
+ if (temp == NULL) {
+ oconfig_free (root);
+ return (NULL);
+ }
+
cf_ci_append_children (root, temp);
sfree (temp->children);
sfree (temp);