con_mark: fix heap-use-after-free

This commit is contained in:
Michael Stapelberg 2016-01-08 20:41:09 +01:00
parent 0d1aad0af4
commit 08976f7a2a
1 changed files with 2 additions and 1 deletions

View File

@ -608,7 +608,8 @@ void con_mark(Con *con, const char *mark, mark_mode_t mode) {
DLOG("Removing all existing marks on con = %p.\n", con);
mark_t *current;
TAILQ_FOREACH(current, &(con->marks_head), marks) {
while (!TAILQ_EMPTY(&(con->marks_head))) {
current = TAILQ_FIRST(&(con->marks_head));
con_unmark(con, current->name);
}
}