{
struct dir_item *item = array_add(items);
- item->path = concat_string(dir, "/", name, NULL);
+ item->path = *dir ? concat_string(dir, "/", name, NULL) : strdup(name);
item->data = NULL;
return item;
{
while (array_len(items))
del_item(items);
+
+ array_free(items);
}