From: Roy Marples Date: Tue, 20 May 2008 23:01:13 +0000 (+0000) Subject: Plug some valgrind leaks. X-Git-Tag: v4.0.2~355 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82770593eafaf5beec457573a2065d4563daef69;p=thirdparty%2Fdhcpcd.git Plug some valgrind leaks. --- diff --git a/dhcpcd.c b/dhcpcd.c index 059e76cc..2d843257 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -186,7 +186,7 @@ add_environ(struct options *options, const char *value, int uniq) lst[i] = xrealloc(lst[i], l + lv + 2); lst[i][l] = ' '; memcpy(lst[i] + l + 1, p, lv); - lst[i][l + lv + 2] = '\0'; + lst[i][l + lv + 1] = '\0'; } free(match); return lst[i]; @@ -198,7 +198,8 @@ add_environ(struct options *options, const char *value, int uniq) newlist[i] = xstrdup(value); newlist[i + 1] = NULL; options->environ = newlist; - return (newlist[i]); + free(match); + return newlist[i]; } static int