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/rewrite.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/rewrite.c') diff --git a/src/rewrite.c b/src/rewrite.c index c5a497a..6409686 100644 --- a/src/rewrite.c +++ b/src/rewrite.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -11,7 +12,12 @@ struct type_helper { static int rewrite_type_ids(struct type *type, char *orig, char *new) { if (type->k == TYPE_ID && strcmp(type->id, orig) == 0) { - char *r = strdup(new); + char *r = strdupc(new); + if (!r) { + internal_error("failed allocating hole"); + return -1; + } + free(type->id); type->id = r; } @@ -49,7 +55,11 @@ static char *rewrite_hole(char *old, char *new) size_t nn = strlen(new); /* +1 for null terminator */ - char *r = malloc(on + nn + 1); + char *r = mallocc(on + nn + 1); + if (!r) { + internal_error("failed allocating hole rewrite buf"); + return NULL; + } memcpy(r, new, nn); -- cgit v1.2.3