added error checking for malloc
This commit is contained in:
parent
4c9614342e
commit
7fe3d3c107
@ -16,9 +16,11 @@
|
|||||||
char* dyninput_str(int_least64_t maxsize)
|
char* dyninput_str(int_least64_t maxsize)
|
||||||
{
|
{
|
||||||
char* str = malloc(3 * sizeof(char));
|
char* str = malloc(3 * sizeof(char));
|
||||||
/*if (!str)
|
if (!str)
|
||||||
puts("Error allocating memory!");
|
{
|
||||||
return NULL;*/
|
puts("\nError allocating memory!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int_least64_t size = 3, i = 0;
|
int_least64_t size = 3, i = 0;
|
||||||
char c = 0;
|
char c = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user