commit 86fc4389c462d2c70807218241cf77f512bf67a3
parent 1a725c9dc69d0045f75ff2632b54a7e4d05108f5
Author: Frederic Cambus <fred@statdns.com>
Date: Sun, 14 Feb 2021 21:35:43 +0100
Check strdup() return value when allocating output file name.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/ansilove.c b/src/ansilove.c
@@ -316,6 +316,9 @@ main(int argc, char *argv[])
errx(EXIT_FAILURE, "Memory allocation error.");
} else {
fileName = strdup(output);
+
+ if (!fileName)
+ errx(EXIT_FAILURE, "Memory allocation error.");
}
/* display name of input and output files */