plug some more memory leaks.

This commit is contained in:
Enno Rehling 2014-12-30 01:44:28 +01:00
parent 89ce04a6c3
commit 49a77cdcde
4 changed files with 11 additions and 4 deletions

View File

@ -141,6 +141,8 @@ void racelist_insert(struct race_list **rl, const struct race *r)
void free_races(void) {
while (races) {
race * rc = races->next;
free(races->_name);
free(races->def_damage);
free(races);
races = rc;
}

View File

@ -119,7 +119,7 @@ extern "C" {
typedef struct race {
struct param *parameters;
const char *_name;
char *_name;
float magres;
float maxaura; /* Faktor auf Maximale Aura */
float regaura; /* Faktor auf Regeneration */
@ -133,7 +133,7 @@ extern "C" {
float speed;
float aggression; /* chance that a monster will attack */
int hitpoints;
const char *def_damage;
char *def_damage;
int armor;
int at_default; /* Angriffsskill Unbewaffnet (default: -2) */
int df_default; /* Verteidigungsskill Unbewaffnet (default: -2) */

View File

@ -238,8 +238,13 @@ void free_ship(ship * s)
free(s);
}
static void free_shiptype(ship_type *stype) {
free(stype->_name);
free(stype);
}
void free_shiptypes(void) {
ql_foreach(shiptypes, free);
ql_foreach(shiptypes, free_shiptype);
ql_free(shiptypes);
shiptypes = 0;
}

View File

@ -33,7 +33,7 @@ extern "C" {
#define SFL_NOCOAST 0x04
typedef struct ship_type {
const char *_name;
char *_name;
int range; /* range in regions */
int flags; /* flags */