fire: Plug memory leak when missile defense sinks firing ships
do_defdam() iterates over the list firing ships, applies return fire to each, and frees its list element. When it finds a ship that has been sunk already, it skips it. This also skips the free, leaking the list element. The leak goes back to flawed bug fix in Empire 2. As far as I can see, missile defense is the only way a ship can be sunk there. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
656c3e7645
commit
25c96cc3ac
1 changed files with 1 additions and 2 deletions
|
@ -427,6 +427,7 @@ multifire(void)
|
|||
else
|
||||
odds = 1.0;
|
||||
do_defdam(&fired, odds);
|
||||
free_flist(&fired);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
@ -496,8 +497,6 @@ do_defdam(struct emp_qelem *list, double odds)
|
|||
wu(0, vict, "Return fire hit sector %s for %d damage.\n",
|
||||
xyas(fp->x, fp->y, vict), dam);
|
||||
}
|
||||
emp_remque(&fp->queue);
|
||||
free(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue