diff options
-rw-r--r-- | globals.c | 5 | ||||
-rw-r--r-- | instr-daemon.c | 10 |
2 files changed, 14 insertions, 1 deletions
@@ -2,7 +2,10 @@ GlobalStruct globals = { .ChannelState = {0.0}, - .Flash = { "FIXME", (int)1, (char)0, (char)0 }, + .Flash = { .aux_error_message="FIXME", + .channels = (int)1, + .enable_avrq_extra_ampls = (char)0, + .ChanKey_frequency = (char)0 }, .error_queue = {0}, .number_of_errors = 0 }; 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 |