forked from github/server
CID 22519 et al (resource leaks)
make the failure case for get_spellbook a little slower, but make static analysis happy.
This commit is contained in:
parent
9ff6aa0d42
commit
fed660987a
|
@ -2985,6 +2985,8 @@ spellbook * get_spellbook(const char * name)
|
|||
log_error("cb_insert failed although cb_find returned nothing for spellbook=%s", name);
|
||||
assert(!"should not happen");
|
||||
}
|
||||
cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0);
|
||||
cb_get_kv(match, &result, sizeof(result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -53,8 +53,9 @@ void test_spellbooks(CuTest * tc)
|
|||
test_cleanup();
|
||||
|
||||
herp = get_spellbook("herp");
|
||||
derp = get_spellbook("derp");
|
||||
CuAssertPtrNotNull(tc, herp);
|
||||
CuAssertPtrEquals(tc, herp, get_spellbook("herp"));
|
||||
derp = get_spellbook("derp");
|
||||
CuAssertPtrNotNull(tc, derp);
|
||||
CuAssertTrue(tc, derp != herp);
|
||||
CuAssertStrEquals(tc, "herp", herp->name);
|
||||
|
|
Loading…
Reference in New Issue