diff options
Diffstat (limited to 'instr-daemon.c')
-rw-r--r-- | instr-daemon.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/instr-daemon.c b/instr-daemon.c index ff43579..f4bd0b2 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -41,6 +41,11 @@ stdinAvailable (GIOChannel *source, GIOCondition condition, gpointer data) if(!strncmp(tmp, "..", size-1)) { //final reallocation of the buffer to accomodate the whole string buffer=realloc(buffer,allocated+1); + if(buffer==NULL) + { + g_printerr("realloc FAILED! Exiting!"); + exit(-1); + } buffer[allocated] = '\0'; g_print_debug("Got the buffer: \"%s\", tid: %p\n", buffer, g_thread_self()); @@ -70,6 +75,11 @@ stdinAvailable (GIOChannel *source, GIOCondition condition, gpointer data) //allocate on the heap. buffer is NULL the first time buffer=realloc(buffer, allocated+size); + if(buffer==NULL) + { + g_printerr("realloc FAILED! Exiting!"); + exit(-1); + } memcpy(buffer+allocated, tmp, size); allocated += size; //keep track of allocation |