forked from github/server
memory leak: castorders
when you test_create_castorder, you must free_castorder
This commit is contained in:
parent
c9e524d161
commit
c21d5290ef
|
@ -44,19 +44,21 @@ static void test_flyingship(CuTest * tc)
|
||||||
|
|
||||||
sh1 = test_create_ship(r, shipType1);
|
sh1 = test_create_ship(r, shipType1);
|
||||||
par_data.data.sh = sh1;
|
par_data.data.sh = sh1;
|
||||||
test_create_castorder(&co, u, 10, 10.0, 0, &par);
|
|
||||||
|
|
||||||
|
test_create_castorder(&co, u, 10, 10.0, 0, &par);
|
||||||
CuAssertTrue(tc, !flying_ship(sh1));
|
CuAssertTrue(tc, !flying_ship(sh1));
|
||||||
CuAssertIntEquals(tc, 10, sp_flying_ship(&co));
|
CuAssertIntEquals(tc, 10, sp_flying_ship(&co));
|
||||||
CuAssertTrue(tc, flying_ship(sh1));
|
CuAssertTrue(tc, flying_ship(sh1));
|
||||||
|
free_castorder(&co);
|
||||||
|
|
||||||
sh2 = test_create_ship(r, shipType2);
|
sh2 = test_create_ship(r, shipType2);
|
||||||
par_data.data.sh = sh2;
|
par_data.data.sh = sh2;
|
||||||
test_create_castorder(&co, u, 10, 10.0, 0, &par);
|
|
||||||
|
|
||||||
|
test_create_castorder(&co, u, 10, 10.0, 0, &par);
|
||||||
CuAssertTrue(tc, !flying_ship(sh2));
|
CuAssertTrue(tc, !flying_ship(sh2));
|
||||||
CuAssertIntEquals(tc, 0, sp_flying_ship(&co));
|
CuAssertIntEquals(tc, 0, sp_flying_ship(&co));
|
||||||
CuAssertTrue(tc, !flying_ship(sh2));
|
CuAssertTrue(tc, !flying_ship(sh2));
|
||||||
|
free_castorder(&co);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue