forked from github/server
leak: do not create new message_type objects in test_cleanup
This commit is contained in:
parent
d79745812a
commit
d4655ee88a
4 changed files with 7 additions and 9 deletions
|
@ -1597,10 +1597,6 @@ void kernel_init(void)
|
||||||
{
|
{
|
||||||
register_reports();
|
register_reports();
|
||||||
mt_clear();
|
mt_clear();
|
||||||
if (!mt_find("missing_message")) {
|
|
||||||
mt_register(mt_new_va("missing_message", "name:string", 0));
|
|
||||||
mt_register(mt_new_va("missing_feedback", "unit:unit", "region:region", "command:order", "name:string", 0));
|
|
||||||
}
|
|
||||||
attrib_init();
|
attrib_init();
|
||||||
translation_init();
|
translation_init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,6 @@ CuSuite *get_curse_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_good_dreams);
|
SUITE_ADD_TEST(suite, test_good_dreams);
|
||||||
SUITE_ADD_TEST(suite, test_bad_dreams);
|
SUITE_ADD_TEST(suite, test_bad_dreams);
|
||||||
SUITE_ADD_TEST(suite, test_memstream);
|
SUITE_ADD_TEST(suite, test_memstream);
|
||||||
DISABLE_TEST(suite, test_write_flag);
|
SUITE_ADD_TEST(suite, test_write_flag);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,9 @@ struct message *msg_feedback(const struct unit *u, struct order *ord,
|
||||||
|
|
||||||
if (!mtype) {
|
if (!mtype) {
|
||||||
log_error("trying to create message of unknown type \"%s\"\n", name);
|
log_error("trying to create message of unknown type \"%s\"\n", name);
|
||||||
|
if (!mt_find("missing_feedback")) {
|
||||||
|
mt_register(mt_new_va("missing_feedback", "unit:unit", "region:region", "command:order", "name:string", 0));
|
||||||
|
}
|
||||||
return msg_message("missing_feedback", "unit region command name", u,
|
return msg_message("missing_feedback", "unit region command name", u,
|
||||||
u->region, ord, name);
|
u->region, ord, name);
|
||||||
}
|
}
|
||||||
|
@ -154,6 +157,9 @@ message *msg_message(const char *name, const char *sig, ...)
|
||||||
if (!mtype) {
|
if (!mtype) {
|
||||||
log_warning("trying to create message of unknown type \"%s\"\n", name);
|
log_warning("trying to create message of unknown type \"%s\"\n", name);
|
||||||
if (strcmp(name, "missing_message") != 0) {
|
if (strcmp(name, "missing_message") != 0) {
|
||||||
|
if (!mt_find("missing_message")) {
|
||||||
|
mt_register(mt_new_va("missing_message", "name:string", 0));
|
||||||
|
}
|
||||||
return msg_message("missing_message", "name", name);
|
return msg_message("missing_message", "name", name);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -97,10 +97,6 @@ void test_cleanup(void)
|
||||||
for (i = 0; i != MAXKEYWORDS; ++i) {
|
for (i = 0; i != MAXKEYWORDS; ++i) {
|
||||||
enable_keyword(i, true);
|
enable_keyword(i, true);
|
||||||
}
|
}
|
||||||
if (!mt_find("missing_message")) {
|
|
||||||
mt_register(mt_new_va("missing_message", "name:string", 0));
|
|
||||||
mt_register(mt_new_va("missing_feedback", "unit:unit", "region:region", "command:order", "name:string", 0));
|
|
||||||
}
|
|
||||||
if (errno) {
|
if (errno) {
|
||||||
int error = errno;
|
int error = errno;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
Loading…
Reference in a new issue