This commit fixes several instances where elements are created
but never free'd.
Although these tests may be run in their own process space,
and at the completion of the tests the memory will be free'd,
it is still good practice to clean up.
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@664
64e312b2-a51f-0410-8e61-
82d0ca0eb02a
ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 1, Errors: 0") == 0,
"SRunner stat string incorrect with checked setup failure");
-
+ free(strstat);
trm = tr_str(srunner_failures(sr)[0]);
/* Search for check_check_fixture.c:129 if this fails. */
ck_abort_msg (errm);
}
+ free(trm);
}
END_TEST
ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 0, Errors: 1") == 0,
"SRunner stat string incorrect with checked setup signal");
-
+ free(strstat);
trm = tr_str(srunner_failures(sr)[0]);
ck_abort_msg (errm);
}
+ free(trm);
}
END_TEST
ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 1, Errors: 0") == 0,
"SRunner stat string incorrect with checked setup failure");
-
+ free(strstat);
trm = tr_str(srunner_failures(sr)[0]);
ck_abort_msg (errm);
}
-
+ free(trm);
}
END_TEST
ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 0, Errors: 1") == 0,
"SRunner stat string incorrect with checked teardown signal");
-
+ free(strstat);
trm = tr_str(srunner_failures(sr)[0]);
ck_abort_msg (errm);
}
-
+ free(trm);
}
END_TEST
for (i = 0; i < nr_of_failures; i++) {
char *trm = tr_str(tra[i]);
if (strlen(errm) + strlen(trm) > 1022) {
+ free(trm);
break;
}
strcat(errm, trm);
START_TEST(test_summary)
{
- ck_assert_msg(strcmp(sr_stat_str(sr),
+ char * string = sr_stat_str(sr);
+ ck_assert_msg(strcmp(string,
"100%: Checks: 0, Failures: 0, Errors: 0") == 0,
"Bad statistics string for empty suite");
+ free(string);
}
END_TEST
ck_assert_msg (srunner_has_log (sr), "SRunner not logging");
ck_assert_msg (strcmp(srunner_log_fname(sr), "test_log") == 0,
"Bad file name returned");
+
+ srunner_free(sr);
}
END_TEST
/* restore old environment */
ck_assert_msg(restore_env("CK_LOG_FILE_NAME", old_val) == 0,
"Failed to restore environment variable");
+
+ srunner_free(sr);
}
END_TEST
ck_assert_msg (!srunner_has_log (sr), "SRunner not logging");
ck_assert_msg (srunner_log_fname(sr) == NULL, "Bad file name returned");
+
+ srunner_free(sr);
}
END_TEST
ck_assert_msg(strcmp(srunner_log_fname(sr), "test_log") == 0,
"Log file is initialize only and shouldn't be changeable once set");
+
+ srunner_free(sr);
}
END_TEST
ck_assert_msg (srunner_has_xml (sr), "SRunner not logging XML");
ck_assert_msg (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
"Bad file name returned");
+
+ srunner_free(sr);
}
END_TEST
/* restore old environment */
ck_assert_msg(restore_env("CK_XML_LOG_FILE_NAME", old_val) == 0,
"Failed to restore environment variable");
+
+ srunner_free(sr);
}
END_TEST
ck_assert_msg (!srunner_has_xml (sr), "SRunner not logging XML");
ck_assert_msg (srunner_xml_fname(sr) == NULL, "Bad file name returned");
+
+ srunner_free(sr);
}
END_TEST
ck_assert_msg(strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
"XML Log file is initialize only and shouldn't be changeable once set");
+
+ srunner_free(sr);
}
END_TEST
tc_core_subunit = tcase_create("Core SubUnit");
suite_add_tcase(s, tc_core_subunit);
tcase_add_test(tc_core_subunit, test_init_logging_subunit);
-#else
- tcase_create("Core SubUnit");
#endif
return s;