From c30c122027811fc158c5d5711d0fb9116f75a089 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 26 Oct 2015 22:43:31 +0000 Subject: [PATCH] fix couple compiler warnings src/getdata.c:248:22: warning: 'range_p' may be used uninitialized in this function [-Wmaybe-uninitialized] src/other.c:383:1: warning: control reaches end of non-void function [-Wreturn-type] Signed-off-by: Sami Kerola --- src/getdata.c | 5 ++++- src/other.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/getdata.c b/src/getdata.c index 591d743..ce56a2b 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -178,7 +178,7 @@ void parse_config(int is_include, const char *restrict config_file, char *word; int braces_shared = 1000; union ipaddr_t addr; - struct range_t *range_p; + struct range_t *range_p = NULL; word = xmalloc(sizeof(char) * MAXLEN); if (is_include) @@ -245,6 +245,9 @@ void parse_config(int is_include, const char *restrict config_file, c = ' '; break; } else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) { + if (!range_p) { + error(EXIT_FAILURE, 0, "parse_config: range_p uninitialized: please report a bug"); + } range_p->last_ip = range_p->first_ip; goto newrange; } diff --git a/src/other.c b/src/other.c index 67c2f4d..040c55a 100644 --- a/src/other.c +++ b/src/other.c @@ -380,6 +380,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg) return num; err: error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); + return 0; } /*! \brief Reverse range.