summaryrefslogtreecommitdiff
path: root/instr-daemon.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-14 12:43:23 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-14 12:43:23 -0400
commit7f68698142507faecdf74e0a572f2e526b8ffcd3 (patch)
tree6df534b82ce6693ced474a962b8fe6f967b4bc35 /instr-daemon.c
parentfed09a34189c3e2f3e8378f143c63683767d0104 (diff)
Fix cppcheck warning, and add explicit Flash init names
Diffstat (limited to 'instr-daemon.c')
-rw-r--r--instr-daemon.c10
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