commit: 36816501ddd5601cb5bf2791a4903f9dd1014a5d
parent 73156a211e8a46eff3b5d55ba11a1a90c602fea6
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 29 Jul 2025 10:31:42 +0200
cmd/cut: fix memory leak found via clang LeakSanitizer
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cmd/cut.c b/cmd/cut.c
@@ -227,7 +227,8 @@ cut_c(FILE *in, const char *filename)
if(line_w == NULL)
{
fprintf(stderr, "%s: error: Failed memory allocation: %s\n", argv0, strerror(errno));
- return -1;
+ err = 1;
+ break;
}
line_wsz = nread;
}
@@ -261,7 +262,8 @@ cut_c(FILE *in, const char *filename)
fputwc(line_delim_w, stdout);
}
- if(line_len != 0) free(line);
+ free(line);
+ free(line_w);
return err;
}