From c86fd0ca8cfb6451227fc08c2b7f8db2d00d8a4d Mon Sep 17 00:00:00 2001 From: brarcher Date: Tue, 17 Dec 2013 22:12:23 +0000 Subject: [PATCH] create function for freeing a TestResult git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@894 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- src/check.c | 15 ++++++++++++--- src/check_impl.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/check.c b/src/check.c index cf82b90..2af3c78 100644 --- a/src/check.c +++ b/src/check.c @@ -328,9 +328,7 @@ void srunner_free (SRunner *sr) l = sr->resultlst; for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) { tr = check_list_val(l); - free(tr->file); - free(tr->msg); - free(tr); + tr_free(tr); } check_list_free (sr->resultlst); @@ -395,6 +393,10 @@ TestResult *tr_create(void) void tr_reset(TestResult *tr) { + if(tr->msg != NULL) + { + printf("BMA: Resetting: %s:%d, %s\n", __FILE__, __LINE__, tr->msg); + } tr_init(tr); } @@ -410,6 +412,13 @@ static void tr_init (TestResult *tr) tr->duration = -1; } +void tr_free(TestResult *tr) +{ + free(tr->file); + free(tr->msg); + free(tr); +} + const char *tr_msg (TestResult *tr) { diff --git a/src/check_impl.h b/src/check_impl.h index d0e6745..cef3e75 100644 --- a/src/check_impl.h +++ b/src/check_impl.h @@ -84,6 +84,7 @@ struct TestResult { TestResult *tr_create(void); void tr_reset(TestResult *tr); +void tr_free(TestResult *tr); enum cl_event { CLINITLOG_SR, /* Initialize log file */ -- 2.40.0