From d83bd3bec5c415ae41f824767c970e7b70dd39c2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 11 Mar 2016 11:52:36 +0100 Subject: [PATCH] memory leak: finally found that coast leak. bad test was overwriting coasts without free (setting custom coasts in a test is not easy). --- src/piracy.test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/piracy.test.c b/src/piracy.test.c index dee326980..419f73073 100644 --- a/src/piracy.test.c +++ b/src/piracy.test.c @@ -47,6 +47,7 @@ static void setup_pirate(unit **pirate, int p_r_flags, int p_rc_flags, const cha if (v_shiptype) { st_boat = st_get_or_create(v_shiptype); u_set_ship(*victim, test_create_ship((*victim)->region, st_boat)); + free(st_boat->coasts); st_boat->coasts = (struct terrain_type **)calloc(2, sizeof(struct terrain_type *)); st_boat->coasts[0] = vterrain; st_boat->coasts[1] = 0; @@ -59,6 +60,7 @@ static void setup_pirate(unit **pirate, int p_r_flags, int p_rc_flags, const cha if (p_shiptype) { st_boat = st_get_or_create(p_shiptype); u_set_ship(*pirate, test_create_ship((*pirate)->region, st_boat)); + free(st_boat->coasts); st_boat->coasts = (struct terrain_type **)calloc(2, sizeof(struct terrain_type *)); st_boat->coasts[0] = vterrain; st_boat->coasts[1] = 0;