about summary refs log tree commit diff stats
path: root/tests/test_common.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-21 21:07:35 +0000
committerJames Booth <boothj5@gmail.com>2014-01-21 21:07:35 +0000
commit2bc22981fd351a8c4c2b4878781fbea8eb1f55ea (patch)
tree0f0785713d316a48e9699032b4a39c3e82a96e4f /tests/test_common.c
parent6468f40dd97abff10de945c5cc731b078007fe0e (diff)
downloadprofani-tty-2bc22981fd351a8c4c2b4878781fbea8eb1f55ea.tar.gz
Fixed memory leaks from str_replace
Diffstat (limited to 'tests/test_common.c')
-rw-r--r--tests/test_common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_common.c b/tests/test_common.c
index 0d02bbd0..146cb7d0 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -14,6 +14,8 @@ void replace_one_substr(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("it was a string", result);
+
+    free(result);
 }
 
 void replace_one_substr_beginning(void **state)
@@ -25,6 +27,8 @@ void replace_one_substr_beginning(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("that is a string", result);
+
+    free(result);
 }
 
 void replace_one_substr_end(void **state)
@@ -36,6 +40,8 @@ void replace_one_substr_end(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("it is a thing", result);
+
+    free(result);
 }
 
 void replace_two_substr(void **state)
@@ -47,6 +53,8 @@ void replace_two_substr(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("it was a was string", result);
+
+    free(result);
 }
 
 void replace_char(void **state)
@@ -58,6 +66,8 @@ void replace_char(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("some &amp; a thing &amp; something else", result);
+
+    free(result);
 }
 
 void replace_when_none(void **state)
@@ -69,6 +79,8 @@ void replace_when_none(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("its another string", result);
+
+    free(result);
 }
 
 void replace_when_match(void **state)
@@ -80,6 +92,8 @@ void replace_when_match(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("goodbye", result);
+
+    free(result);
 }
 
 void replace_when_string_empty(void **state)
@@ -91,6 +105,8 @@ void replace_when_string_empty(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("", result);
+
+    free(result);
 }
 
 void replace_when_string_null(void **state)
@@ -113,6 +129,8 @@ void replace_when_sub_empty(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("hello", result);
+
+    free(result);
 }
 
 void replace_when_sub_null(void **state)
@@ -124,6 +142,8 @@ void replace_when_sub_null(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("hello", result);
+
+    free(result);
 }
 
 void replace_when_new_empty(void **state)
@@ -135,6 +155,8 @@ void replace_when_new_empty(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("", result);
+
+    free(result);
 }
 
 void replace_when_new_null(void **state)
@@ -146,6 +168,8 @@ void replace_when_new_null(void **state)
     char *result = str_replace(string, sub, new);
 
     assert_string_equal("hello", result);
+
+    free(result);
 }
 
 void compare_win_nums_less(void **state)