From c4f7e36903cb8bc12e5dbfd01dbe04c6350ef46d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 9 Aug 2017 19:39:29 +0200 Subject: [PATCH 1/2] fix valgrind report in a test (bad rtype construction) --- src/economy.test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/economy.test.c b/src/economy.test.c index 802610880..83c103f7f 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -499,11 +499,12 @@ static void test_modify_production(CuTest *tc) { CuAssertIntEquals(tc, 11, get_item(u, itype)); CuAssertIntEquals(tc, 290, region_getresource(u->region, rtype)); /* used 10 stones to make 10 stones */ - rtype->modifiers = calloc(2, sizeof(resource_mod)); + rtype->modifiers = calloc(3, sizeof(resource_mod)); rtype->modifiers[0].type = RMT_PROD_SAVE; rtype->modifiers[0].race = u->_race; rtype->modifiers[0].value.sa[0] = (short)(0.5+100*d); rtype->modifiers[0].value.sa[1] = 100; + rtype->modifiers[1].type = RMT_END; make_item(u, itype, 10); split_allocations(u->region); CuAssertIntEquals(tc, 21, get_item(u, itype)); @@ -541,6 +542,7 @@ static void test_modify_production(CuTest *tc) { rtype->modifiers[1].type = RMT_PROD_REQUIRE; rtype->modifiers[1].race = u_race(u); rtype->modifiers[1].btype = NULL; + rtype->modifiers[2].type = RMT_END; test_clear_messages(u->faction); make_item(u, itype, 10); From 62d8024c49507afd20c07ff4a280901d17cd511e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 9 Aug 2017 19:18:45 +0200 Subject: [PATCH 2/2] fix dupe detection --- src/modules/autoseed.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index efb61245e..343c742ee 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -172,8 +172,7 @@ newfaction *read_newfactions(const char *filename) sz += strlcat(password, itoa36(rng_int()), sizeof(password)); } for (f = factions; f; f = f->next) { - if (strcmp(f->email, email) == 0 && f->subscription - && f->age < MINAGE_MULTI) { + if (strcmp(f->email, email) == 0 && f->age < MINAGE_MULTI) { log_warning("email %s already in use by %s", email, factionname(f)); break; }