From: Roy Marples Date: Wed, 21 Feb 2007 10:50:24 +0000 (+0000) Subject: Clean up some valgrind errors X-Git-Tag: v3.2.3~312 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d75f02b58e49ba07dd633c8b2d234ca625dc345e;p=thirdparty%2Fdhcpcd.git Clean up some valgrind errors --- diff --git a/configure.c b/configure.c index 79877eb9..703e929d 100644 --- a/configure.c +++ b/configure.c @@ -51,10 +51,11 @@ static char *cleanmetas (const char *cstr) { /* The largest single element we can have is 256 bytes according to the RFC, so this buffer size should be safe even if it's all ' */ - char buffer[1024] = {0}; + static char buffer[1024]; char *b = buffer; - if (! cstr || strlen (cstr) == 0) + memset (buffer, 0, sizeof (buffer)); + if (cstr == NULL || strlen (cstr) == 0) return b; do @@ -343,7 +344,7 @@ static int write_info(const interface_t *iface, const dhcp_t *dhcp, } if (dhcp->hostname) - fprintf (f, "HOSTNAME='%s'\n",cleanmetas (dhcp->hostname)); + fprintf (f, "HOSTNAME='%s'\n", cleanmetas (dhcp->hostname)); if (dhcp->dnsdomain) fprintf (f, "DNSDOMAIN='%s'\n", cleanmetas (dhcp->dnsdomain));