summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdstat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mdstat.c b/mdstat.c
index a971a957..29e78362 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -123,13 +123,15 @@ static void mdstat_ent_list_detach_element(struct mdstat_ent **list_head, struct
ent->next = el->next;
break;
}
+
+ ent = ent->next;
}
- ent = ent->next;
}
+ /* Guard if not found or list is empty - not allowed */
assert(ent);
- ent->next = NULL;
+ el->next = NULL;
}
void free_mdstat(struct mdstat_ent *ms)