diff --git a/src/shared/tester.c b/src/shared/tester.c
index 06fc415..eafbfb0 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
#include <signal.h>
#include <sys/signalfd.h>
#include <glib.h>
+#include "src/shared/util.h"
#include "src/shared/tester.h"
#define COLOR_OFF "\x1B[0m"
if (test->destroy)
test->destroy(test->user_data);
- g_free(test->name);
- g_free(test);
+ free(test->name);
+ free(test);
}
void tester_print(const char *format, ...)
return;
}
- test = g_new0(struct test_case, 1);
+ test = new0(struct test_case, 1);
+ if (!test) {
+ if (destroy)
+ destroy(user_data);
+ return;
+ }
- test->name = g_strdup(name);
+ test->name = strdup(name);
test->result = TEST_RESULT_NOT_RUN;
test->stage = TEST_STAGE_INVALID;
wait->func(wait->user_data);
- g_free(wait);
+ free(wait);
return FALSE;
}
test = test_current->data;
- print_progress(test->name, COLOR_BLACK, "waiting %u seconds", seconds);
-
- wait = g_new0(struct wait_data, 1);
+ wait = new0(struct wait_data, 1);
+ if (!wait)
+ return;
wait->seconds = seconds;
wait->test = test;
wait->user_data = user_data;
g_timeout_add(1000, wait_callback, wait);
+
+ print_progress(test->name, COLOR_BLACK, "waiting %u seconds", seconds);
}
static gboolean signal_handler(GIOChannel *channel, GIOCondition condition,