From f4c2269d7f0f05edc66f572df8fcf418a665aebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n=20Zachrisson?= Date: Sun, 1 Nov 2015 12:55:01 +0100 Subject: [PATCH] Check if the bin_path malloc failed --- cue2pops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cue2pops.c b/cue2pops.c index d883c3c..4ac7eb6 100644 --- a/cue2pops.c +++ b/cue2pops.c @@ -504,6 +504,11 @@ int main(int argc, char **argv) bin_path = malloc((strlen(ptr) + strlen(argv[1])) * 2); + if (bin_path == NULL) { + printf("Error: Failed to allocate memory for the bin_path string\n"); + free(cuebuf); + return 0; + } for(i = strlen(ptr); i > 0; i--) { // Does the cue have the full BINARY path ? if((ptr[i] == '\\') || (ptr[i] == '/')) { // YES !