From c5585a3520c12167fe8fdb4997e2a9a37d01c94e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 2 Jan 2006 22:29:07 +0000 Subject: [PATCH] more memory leaks fixed --- src/common/gamecode/economy.c | 4 ++-- src/common/kernel/message.c | 2 +- src/common/kernel/movement.c | 2 +- src/common/kernel/save.c | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 2ee7169d6..11c1046e6 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -1522,8 +1522,8 @@ split_allocations(region * r) msg_message("produce_lowskill", "unit region resource", al->unit, al->unit->region, rtype)); } else { - add_message(&al->unit->faction->msgs, - msg_message("produce", "unit region amount wanted resource", + ADDMSG(&al->unit->faction->msgs, msg_message("produce", + "unit region amount wanted resource", al->unit, al->unit->region, al->get, al->want, rtype)); } *p_al=al->next; diff --git a/src/common/kernel/message.c b/src/common/kernel/message.c index ad5c76dc1..879e5c56a 100644 --- a/src/common/kernel/message.c +++ b/src/common/kernel/message.c @@ -362,7 +362,7 @@ mistake(const unit * u, struct order * ord, const char *comment, int mtype) if (u->faction->no != MONSTER_FACTION) { char * cmt = strdup(comment); ADDMSG(&u->faction->msgs, msg_message("mistake", - "command error unit region", copy_order(ord), cmt, u, u->region)); + "command error unit region", ord, cmt, u, u->region)); } } diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 47c2209b1..5a85f032d 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -1431,7 +1431,7 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order } if (mode!=TRAVEL_TRANSPORTED) { ADDMSG(&u->faction->msgs, msg_message("travel", - "unit mode start end regions", u, walkmode, r, current, strdup(buf))); + "unit mode start end regions", u, walkmode, r, current, buf)); } mark_travelthru(u, r, route_begin, iroute); diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 4c2e1c4f7..584ce8e02 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1102,12 +1102,14 @@ readunit(FILE * F) if (!is_persistent(ord) || ++pnext; + ord = NULL; } else if (p==MAXPERSISTENT) { log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT)); } } else if (n==MAXORDERS) { log_error(("%s had %d or more orders\n", unitname(u), MAXORDERS)); } + if (ord!=NULL) free_order(ord); } freadstr(F, buf, sizeof(buf)); }