diff options
author | Sierraffinity <sierra@domoreaweso.me> | 2020-04-22 16:55:01 -0700 |
---|---|---|
committer | Sierraffinity <sierra@domoreaweso.me> | 2020-04-22 16:55:01 -0700 |
commit | 8c01d4f9373ad7ef866a3352d2c81f9f24a13ac0 (patch) | |
tree | 8636a1cd4327d69203237024c3d5bf8407d09ff2 | |
parent | ef107002b58360787bfe7541cdf9e734457104dc (diff) |
gbagfx: Check for nullptr for new output path
-rw-r--r-- | tools/gbagfx/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
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++) { |