diff --git a/t/t_main.c b/t/t_main.c index 30f0423..fb6a9dc 100644 --- a/t/t_main.c +++ b/t/t_main.c @@ -146,18 +146,18 @@ t_run_test(struct t_test *t, int n) char *desc; int ret; - desc = t->desc ? t->desc : "no description"; + desc = t->desc; ret = (*t->func)(&desc, t->arg); - if (ret > 0) { - printf("ok %d - %s\n", n + 1, desc); - return (1); - } else if (ret < 0) { - printf("ok %d - # skip %s\n", n + 1, desc); - return (1); - } else { - printf("not ok %d - %s\n", n + 1, desc); - return (0); - } + if (ret > 0) + printf("ok %d - ", n + 1); + else if (ret < 0) + printf("ok %d - # skip ", n + 1); + else + printf("not ok %d - ", n + 1); + printf("%s\n", desc ? desc : "no description"); + if (desc != t->desc) + free(desc); + return (ret); } /* diff --git a/t/t_malloc.c b/t/t_malloc.c index 2cc9918..83cfd74 100644 --- a/t/t_malloc.c +++ b/t/t_malloc.c @@ -491,7 +491,7 @@ t_malloc_leaked(char **desc, void *arg CRYB_UNUSED) asprintf(desc, "%lu allocation(s) leaked", nleaked); return (0); } else { - *desc = "no memory leaked"; + asprintf(desc, "%s", "no memory leaked"); return (1); } #else