Signed-off-by: Liu Yuan <namei.u...@gmail.com> --- sheep/md.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sheep/md.c b/sheep/md.c index b79fde4..37feeb2 100644 --- a/sheep/md.c +++ b/sheep/md.c @@ -283,6 +283,12 @@ bool md_add_disk(const char *path) return true; } +static inline void vdisk_free(struct vdisk *v) +{ + rb_erase(&v->rb, &md.vroot); + free(v); +} + static inline void md_remove_disk(struct disk *disk) { struct vdisk *v; @@ -292,7 +298,7 @@ static inline void md_remove_disk(struct disk *disk) md.nr_disks--; rb_for_each_entry(v, &md.vroot, rb) { if (v->disk == disk) - rb_erase(&v->rb, &md.vroot); + vdisk_free(v); } free(disk); } -- 1.7.9.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog