From 9fda2cdb2f031c61d125ab2f8684a143ed868b51 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 10 Apr 2014 01:29:01 +0300 Subject: [PATCH] Fix static analyze errors. --- client/client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/client.c b/client/client.c index 2b2bb68..df56511 100644 --- a/client/client.c +++ b/client/client.c @@ -32,8 +32,11 @@ static ptrdiff_t getLine(char **outLine, size_t *outAllocated, FILE *stream) } for (s = buffer;;) { - if (fgets(s, allocated - (s - buffer), stream) == NULL) + if (fgets(s, allocated - (s - buffer), stream) == NULL) { + *outAllocated = allocated; + *outLine = buffer; return -1; + } len = strlen(s); if (feof(stream)) @@ -68,7 +71,7 @@ static ptrdiff_t getLine(char **outLine, size_t *outAllocated, FILE *stream) static void readItemsToMenuFromStdin(bmMenu *menu) { ptrdiff_t len; - size_t size; + size_t size = 0; char *line = NULL; while ((len = getLine(&line, &size, stdin)) != -1) {