diff options
| author | sanine <sanine.not@pm.me> | 2022-04-04 13:03:39 -0500 | 
|---|---|---|
| committer | sanine <sanine.not@pm.me> | 2022-04-04 13:03:39 -0500 | 
| commit | 4facafcf702ec54694451d5bdda4f1faff94718d (patch) | |
| tree | 90f869e21579cda0f8e0848b2744971ce913dace /tests | |
| parent | c4619e22d571bffa75ab033fceda7915c676f90d (diff) | |
fix memory leak in _lily_assert_msg
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/assertions.c | 14 | 
1 files changed, 12 insertions, 2 deletions
| diff --git a/tests/assertions.c b/tests/assertions.c index 6471225..fa7e82d 100644 --- a/tests/assertions.c +++ b/tests/assertions.c @@ -1,4 +1,5 @@  #include <stdio.h> +#include <stdlib.h>  #include <string.h>  #include "lily-test.h" @@ -8,7 +9,7 @@ const char *test_LILY_LOCATION()  {     // if you move this line, you MUST update the expected string!     const char *location = LILY_LOCATION; -   int diff = strcmp(location, "tests/assertions.c:10"); +   int diff = strcmp(location, "tests/assertions.c:11");     if (diff != 0)        return "LILY_LOCATION did not resolve correctly!"; @@ -39,10 +40,11 @@ const char *test_assert_msg()     else {        if (strcmp(_lily_globals.error_msg, "should fail!") != 0)  	 return "false assertion produced incorrect error message!"; -      if (strcmp(_lily_globals.error_location, "tests/assertions.c:36")) +      if (strcmp(_lily_globals.error_location, "tests/assertions.c:37"))  	 return "false assertion produced incorrect error location!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -71,6 +73,7 @@ const char *test_assert_true()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -98,6 +101,7 @@ const char *test_assert_false()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -130,6 +134,7 @@ const char *test_assert_not_null()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -162,6 +167,7 @@ const char *test_assert_null()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -196,6 +202,7 @@ const char *test_assert_ptr_equal()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -230,6 +237,7 @@ const char *test_assert_ptr_not_equal()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -262,6 +270,7 @@ const char *test_assert_int_equal()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } @@ -293,5 +302,6 @@ const char *test_assert_int_not_equal()  	 return "false assertion produced incorrect error message!";     } +   free(_lily_globals.error_msg);     return 0;  } | 
