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 */
|
/* Don't put them on the list if they're already there */
|
||||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||||
fp = (struct flist *)qp;
|
fp = (struct flist *)qp;
|
||||||
if (fp->type != targ_land && fp->uid == ep->uid)
|
if (fp->type == targ_land
|
||||||
return;
|
? fp->x == ep->x && fp->y == ep->y
|
||||||
if (fp->type != targ_land
|
: fp->uid == ep->uid) {
|
||||||
&& fp->x == ep->x && fp->y == ep->y)
|
free(ep);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
emp_insque(elem, list);
|
emp_insque(elem, list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue