free slug err msg

This commit is contained in:
c9s 2014-06-02 06:56:36 +08:00
parent b2a9ad47d8
commit 2a7998b76f

View file

@ -91,6 +91,7 @@ START_TEST (test_incomplete_slug)
ck_assert_int_eq(cnt, 0); ck_assert_int_eq(cnt, 0);
ck_assert(errstr); ck_assert(errstr);
printf("%s\n",errstr); printf("%s\n",errstr);
free(errstr);
} }
END_TEST END_TEST
@ -140,14 +141,17 @@ START_TEST (test_slug_count)
char * errstr = NULL; char * errstr = NULL;
cnt = slug_count(pattern, strlen(pattern), &errstr); cnt = slug_count(pattern, strlen(pattern), &errstr);
ck_assert_int_eq(cnt, 2); ck_assert_int_eq(cnt, 2);
if(errstr) free(errstr);
char * pattern2 = "/user/{name:\\d{3}}/to/{id}"; char * pattern2 = "/user/{name:\\d{3}}/to/{id}";
cnt = slug_count(pattern2, strlen(pattern2), &errstr); cnt = slug_count(pattern2, strlen(pattern2), &errstr);
ck_assert_int_eq(cnt, 2); ck_assert_int_eq(cnt, 2);
if(errstr) free(errstr);
char * pattern3 = "/user/{name:\\d{3}}/to/{id}"; char * pattern3 = "/user/{name:\\d{3}}/to/{id}";
cnt = slug_count(pattern3, strlen(pattern3), &errstr); cnt = slug_count(pattern3, strlen(pattern3), &errstr);
ck_assert_int_eq(cnt, 2); ck_assert_int_eq(cnt, 2);
if(errstr) free(errstr);
} }
END_TEST END_TEST