team_delete_team() should have called delete_team_struct() instead of just
freeing the team - it leaked dead children semaphores and death entries; waiting for a specific team could not have worked before. Fixed delete_team_struct(), it did not correctly free the death list (would have accessed freed memory). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13890 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -709,11 +709,11 @@ error1:
|
|||||||
static void
|
static void
|
||||||
delete_team_struct(struct team *team)
|
delete_team_struct(struct team *team)
|
||||||
{
|
{
|
||||||
struct death_entry *death = NULL;
|
struct death_entry *death;
|
||||||
|
|
||||||
delete_sem(team->dead_children.sem);
|
delete_sem(team->dead_children.sem);
|
||||||
|
|
||||||
while ((death = list_get_next_item(&team->dead_children.list, death)) != NULL)
|
while ((death = list_remove_head_item(&team->dead_children.list)) != NULL)
|
||||||
free(death);
|
free(death);
|
||||||
|
|
||||||
free(team);
|
free(team);
|
||||||
@@ -846,8 +846,8 @@ team_delete_team(struct team *team)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: what about the dead_children.sem? shouldn't we call delete_team_struct() here?
|
// ToDo: should our death_entries be moved one level up?
|
||||||
free(team);
|
delete_team_struct(team);
|
||||||
|
|
||||||
// notify the debugger, that the team is gone
|
// notify the debugger, that the team is gone
|
||||||
user_debug_team_deleted(teamID, debuggerPort);
|
user_debug_team_deleted(teamID, debuggerPort);
|
||||||
@@ -1533,6 +1533,11 @@ get_team_death_entry(struct team *team, thread_id child, struct death_entry *dea
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Gets the next pending death entry, if any. Also fills in \a _waitSem
|
||||||
|
* to the semaphore the caller have to wait for for other death entries.
|
||||||
|
* Must be called with the team lock held.
|
||||||
|
*/
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
get_death_entry(struct team *team, pid_t child, struct death_entry *death,
|
get_death_entry(struct team *team, pid_t child, struct death_entry *death,
|
||||||
sem_id *_waitSem, struct death_entry **_freeDeath)
|
sem_id *_waitSem, struct death_entry **_freeDeath)
|
||||||
|
|||||||
Reference in New Issue
Block a user