Skip to content

Commit

Permalink
Fixed memory leak in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tailhook committed Jan 7, 2012
1 parent 7610ee0 commit 8b02263
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/runtests.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void testMatch() {
CU_ASSERT_EQUAL(result, -1);
CU_ASSERT_FALSE(ws_match(m, "another text", &result));
CU_ASSERT_EQUAL(result, -1);
ws_match_free(m);
}

void testMatchCompile() {
Expand All @@ -48,7 +49,7 @@ void testMatchCompile() {
CU_ASSERT_EQUAL(result, -1);
CU_ASSERT_FALSE(ws_match(m, "another text", &result));
CU_ASSERT_EQUAL(result, -1);

ws_match_free(m);
}

void testIMatch() {
Expand All @@ -73,6 +74,7 @@ void testIMatch() {
CU_ASSERT_EQUAL(result, -1);
CU_ASSERT_FALSE(ws_imatch(m, "another text", &result));
CU_ASSERT_EQUAL(result, -1);
ws_match_free(m);
}


Expand Down Expand Up @@ -102,6 +104,7 @@ void testIMatchCompile() {
CU_ASSERT_EQUAL(result, -1);
CU_ASSERT_FALSE(ws_imatch(m, "another text", &result));
CU_ASSERT_EQUAL(result, -1);
ws_match_free(m);
}

void testFuzzy() {
Expand Down Expand Up @@ -138,6 +141,7 @@ void testFuzzy() {
CU_ASSERT_EQUAL(result, 37);
CU_ASSERT(ws_fuzzy(m, "/three/seventeen", &result));
CU_ASSERT_EQUAL(result, 37);
ws_fuzzy_free(m);
}

void testDefault() {
Expand All @@ -158,6 +162,7 @@ void testDefault() {
CU_ASSERT_EQUAL(result, 2);
CU_ASSERT(ws_fuzzy(m, "/two2", &result));
CU_ASSERT_EQUAL(result, 2);
ws_fuzzy_free(m);

m = ws_fuzzy_new();
CU_ASSERT_EQUAL(ws_fuzzy_add(m, "", TRUE, 1), 1);
Expand All @@ -175,6 +180,7 @@ void testDefault() {
CU_ASSERT_EQUAL(result, 2);
CU_ASSERT(ws_rfuzzy(m, "test.example.com", &result));
CU_ASSERT_EQUAL(result, 2);
ws_fuzzy_free(m);
}

void testRFuzzy() {
Expand Down Expand Up @@ -211,6 +217,7 @@ void testRFuzzy() {
CU_ASSERT_EQUAL(result, 37);
CU_ASSERT(ws_rfuzzy(m, "testworld.example.net", &result));
CU_ASSERT_EQUAL(result, 37);
ws_fuzzy_free(m);
}

int main(int argc, char **argv) {
Expand Down

0 comments on commit 8b02263

Please sign in to comment.