tests: fix a memory leak
authorBartosz Golaszewski <bartekgola@gmail.com>
Thu, 2 Mar 2017 10:28:24 +0000 (11:28 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Thu, 2 Mar 2017 10:28:24 +0000 (11:28 +0100)
We must free the error string from a failed test after displaying it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/unit/gpiod-unit.c

index 260edb8578b92f78522414053cbc5b06c203d09f..6550577ac97d5e57c383175f27736dc5acea43b4 100644 (file)
@@ -442,6 +442,7 @@ int main(int argc GU_UNUSED, char **argv GU_UNUSED)
                        pr_raw("\n\t\t'%s': %s\n",
                               test->name, globals.test_ctx.failed_msg);
                        reset_color();
+                       free(globals.test_ctx.failed_msg);
                } else {
                        set_color(CGREEN);
                        pr_raw("OK\n");