build: smatch compiler warnings fixed

dhcpd-pools.c:221:20: warning: non-ANSI function declaration of function 'prepare_memory'
getdata.c +178 parse_leases(112) error: potential null derefence 'macstring'.
getdata.c +179 parse_leases(113) error: potential null derefence 'macaddr_p'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-09-10 11:09:41 +02:00
parent cf2b3ace16
commit f6807f8a6d
2 changed files with 9 additions and 7 deletions

View file

@ -218,7 +218,7 @@ int main(int argc, char **argv)
}
/* Global allocations, counter resets etc */
int prepare_memory()
int prepare_memory(void)
{
RANGES = 64;
num_ranges = num_shared_networks = 0;

View file

@ -175,12 +175,14 @@ int parse_leases(void)
&& (sw_active_lease == 1)
&& (xstrstr(line, " hardware ethernet", 19))) {
nth_field(3, macstring, line);
macstring[17] = '\0';
macaddr_p->ethernet = safe_strdup(macstring);
macaddr_p->ip = safe_strdup(ipstring);
macaddr_p->next = safe_malloc(sizeof(struct macaddr_t));
macaddr_p = macaddr_p->next;
macaddr_p->next = NULL;
if (macstring) {
macstring[17] = '\0';
macaddr_p->ethernet = safe_strdup(macstring);
macaddr_p->ip = safe_strdup(ipstring);
macaddr_p->next = safe_malloc(sizeof(struct macaddr_t));
macaddr_p = macaddr_p->next;
macaddr_p->next = NULL;
}
}
}
free(line);