Plug memory leak in fire command
add_to_fired_queue() adds a defender at most once. It neglects to free the defender flist nodes it doesn't add. Broken since option MULTIFIRE appeared in Chainsaw.
This commit is contained in:
parent
7ba662567f
commit
3c7ea15195
1 changed files with 5 additions and 4 deletions
|
@ -902,11 +902,12 @@ add_to_fired_queue(struct emp_qelem *elem, struct emp_qelem *list)
|
|||
/* Don't put them on the list if they're already there */
|
||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||
fp = (struct flist *)qp;
|
||||
if (fp->type != targ_land && fp->uid == ep->uid)
|
||||
return;
|
||||
if (fp->type != targ_land
|
||||
&& fp->x == ep->x && fp->y == ep->y)
|
||||
if (fp->type == targ_land
|
||||
? fp->x == ep->x && fp->y == ep->y
|
||||
: fp->uid == ep->uid) {
|
||||
free(ep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
emp_insque(elem, list);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue