forked from github/server
fix create_unit default order memory leak
This commit is contained in:
parent
0f10b58167
commit
02cfde0a49
|
@ -1492,14 +1492,6 @@ unit *create_unit(region * r, faction * f, int number, const struct race *urace,
|
|||
if (f) {
|
||||
assert(faction_alive(f));
|
||||
u_setfaction(u, f);
|
||||
|
||||
if (f->locale) {
|
||||
order *deford = default_order(f->locale);
|
||||
if (deford) {
|
||||
set_order(&u->thisorder, NULL);
|
||||
addlist(&u->orders, deford);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_number(u, number);
|
||||
|
|
|
@ -3086,6 +3086,14 @@ void maketemp_cmd(unit *u, order **olist)
|
|||
*olist = *ordp;
|
||||
makeord->next = NULL;
|
||||
free_order(makeord);
|
||||
|
||||
if (!u2->orders) {
|
||||
order *deford = default_order(u2->faction->locale);
|
||||
if (deford) {
|
||||
set_order(&u2->thisorder, NULL);
|
||||
addlist(&u2->orders, deford);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue