From 8946c27306abed7065afad3f015df5ee81e72ad2 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 1 May 2026 20:35:00 +0300 Subject: add support for coverage --- src/debug.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/debug.c') diff --git a/src/debug.c b/src/debug.c index 2426277..d229ae6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -272,8 +273,15 @@ static void _type_str(FILE *f, struct type *type) char *type_str(struct type *t) { - if (!t) - return strdup("NULL"); + if (!t) { + char *s = strdupc("NULL"); + if (!s) { + internal_error("failed allocating null string"); + return NULL; + } + + return s; + } char *buf = NULL; size_t size = 0; FILE *memstream = open_memstream(&buf, &size); @@ -283,6 +291,8 @@ char *type_str(struct type *t) _type_str(memstream, t); fclose(memstream); + + track_ptr(buf); return buf; } -- cgit v1.2.3