Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson- committed Sep 26, 2020
1 parent 31e1237 commit 3a626b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/microcuts.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void end_tests(){
}

void begin_section(const char* name){
section_name = malloc(sizeof(char) * strlen(name));
section_name = malloc(sizeof(char) * strlen(name) + 1);
strcpy(section_name, name);
assert_no = 1;
failed = 0;
Expand All @@ -66,6 +66,8 @@ void end_section(){
}
assert_no = INT_MIN;
total_failed += failed;
free(section_name);
section_name = NULL;
}

void __assert(const char* expr_str, int a, const char* file, int line){
Expand Down

0 comments on commit 3a626b2

Please sign in to comment.