fix memory leak in the abts unit test library
This commit is contained in:
parent
8abce6113b
commit
084c256bbe
|
@ -26,7 +26,7 @@ struct sockaddr_un g_logd_addr;
|
|||
|
||||
void d_msg_init()
|
||||
{
|
||||
openlog("wmcore", 0, LOG_DAEMON);
|
||||
openlog("libcore", 0, LOG_DAEMON);
|
||||
|
||||
g_syslog_connected = 1;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
status_t cellwire_initialize(char *config_path)
|
||||
{
|
||||
status_t rv;
|
||||
openlog("cellwire", 0, LOG_DAEMON);
|
||||
|
||||
srand(time(NULL)*getpid());
|
||||
|
||||
|
|
20
test/abts.c
20
test/abts.c
|
@ -208,6 +208,22 @@ static int report(abts_suite *suite)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void abts_free(abts_suite *suite)
|
||||
{
|
||||
sub_suite *ptr = NULL, *next_ptr = NULL;
|
||||
|
||||
ptr = suite->head;
|
||||
while (ptr != NULL) {
|
||||
next_ptr = ptr->next;
|
||||
|
||||
free((void*)ptr->name);
|
||||
free(ptr);
|
||||
ptr = next_ptr;
|
||||
}
|
||||
|
||||
free(suite);
|
||||
}
|
||||
|
||||
void abts_log_message(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -453,6 +469,10 @@ int main(int argc, const char *const argv[]) {
|
|||
}
|
||||
|
||||
rv = report(suite);
|
||||
|
||||
abts_free(suite);
|
||||
|
||||
free(testlist);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue