fix create_unit default order memory leak

This commit is contained in:
Enno Rehling 2017-10-01 17:08:05 +02:00
parent 0f10b58167
commit 02cfde0a49
2 changed files with 8 additions and 8 deletions

View File

@ -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);

View File

@ -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);
}
}
}
}