From b2d8c6793d80709525d1061c3df6f8f54ee130e1 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Wed, 22 Apr 2020 16:53:11 -0700 Subject: [PATCH] gbagfx: Check for nullptr for new output path --- tools/gbagfx/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c index b02f4d9f5..9fd72383d 100644 --- a/tools/gbagfx/main.c +++ b/tools/gbagfx/main.c @@ -552,7 +552,10 @@ int main(int argc, char **argv) FATAL_ERROR("Output file \"%s\" has no extension.\n", outputPath); size_t newOutputPathSize = strlen(inputPath) - strlen(inputFileExtension) + strlen(outputFileExtension); - outputPath = (char *)malloc(newOutputPathSize); + outputPath = malloc(newOutputPathSize); + + if (outputPath == NULL) + FATAL_ERROR("Failed to allocate memory for new output path.\n"); for (int i = 0; i < newOutputPathSize; i++) {