diff --git a/argsparse b/argsparse index 086da48..f9fdfc3 100755 Binary files a/argsparse and b/argsparse differ diff --git a/argsparse.h b/argsparse.h index d81b851..3461118 100644 --- a/argsparse.h +++ b/argsparse.h @@ -109,6 +109,10 @@ void __free_string_array(char** arr, size_t size) { static void* __sized_malloc(size_t size) { void* ptr = malloc(size); + if (ptr == NULL) { + puts("Out of memory!"); + abort(); + } memset(ptr, ((int)(unsigned long)NULL), size); return (void*)ptr; } @@ -145,6 +149,10 @@ static unsigned char __compile_and_equals_sflag(char* flags, char* str) { static char* malloc_str(char* str) { char* ptr = (char*)malloc((strlen(str)) * sizeof(char) + sizeof(char)); + if ((void*)ptr == NULL) { + puts("Out of memory!"); + abort(); + } strcpy(ptr, str); return ptr; }