libei/test/libei-unit-test.c
Peter Hutterer 119b9c74b0 test: fix a memleak in the unit tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 11:37:51 +10:00

37 lines
670 B
C

#include "config.h"
#include <assert.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <munit.h>
#include "util-mem.h"
extern const MunitSuite __start_test_section, __stop_test_section;
int
main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)])
{
size_t sz = 10;
size_t count = 0;
_cleanup_free_ MunitSuite *suites = calloc(sz, sizeof(*suites));
for (const MunitSuite *s = &__start_test_section;
s < &__stop_test_section;
s++) {
assert(count < sz - 1);
suites[count] = *s;
count++;
}
const MunitSuite suite = {
"/ei",
NULL,
suites,
1,
MUNIT_SUITE_OPTION_NONE,
};
return munit_suite_main(&suite, NULL, argc, argv);
}