LIST_FIELDS (struct MountPoint, mount_point);
} MountPoint;
+/* Takes over possession of path */
static MountPoint *mount_point_alloc(char *path) {
MountPoint *mp;
continue;
}
- if (mount_point_is_api(path)) {
- free(path);
- continue;
- }
+ p = cunescape(path);
+ free(path);
- if (!(p = cunescape(path))) {
+ if (!p) {
r = -ENOMEM;
goto finish;
}
+ if (mount_point_is_api(p)) {
+ free(p);
+ continue;
+ }
+
if (!(mp = mount_point_alloc(p))) {
+ free(p);
r = -ENOMEM;
goto finish;
}
- LIST_PREPEND(MountPoint, mount_point, *mount_point_list_head, mp);
- free(path);
+ LIST_PREPEND(MountPoint, mount_point, *mount_point_list_head, mp);
}
r = 0;
finish:
fclose(proc_self_mountinfo);
- free(path);
-
return r;
}