Skip to content

Commit

Permalink
lib: Fix serializer_serialize test
Browse files Browse the repository at this point in the history
I wasn't freeing the deserialized renderer, which obviously leaks a lot
of memory.
I also moved the assert to after these frees, since this test still is
still failing, and I don't want the misleading leak report from ASAN
caused by the early-return.
Come to think of it, I really should refactor test_assert() to set a
flag we always return at the end, so we don't encounter this same issue
later on. // TODO!
  • Loading branch information
vkoskiv committed Jan 8, 2024
1 parent 30395e3 commit a397682
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ bool serializer_serialize(void) {
test_assert(deserialized);

char *ser1 = serialize_renderer(deserialized);
test_assert(stringEquals(ser0, ser1));
bool match = stringEquals(ser0, ser1);

free(ser0);
free(ser1);

cr_destroy_renderer(ext);
cr_destroy_renderer((struct cr_renderer *)deserialized);

test_assert(match);

return true;
}

0 comments on commit a397682

Please sign in to comment.