]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Plug some valgrind leaks.
authorRoy Marples <roy@marples.name>
Tue, 20 May 2008 23:01:13 +0000 (23:01 +0000)
committerRoy Marples <roy@marples.name>
Tue, 20 May 2008 23:01:13 +0000 (23:01 +0000)
dhcpcd.c

index 059e76ccdcd433fc0964cff487ef7cde4718edd1..2d843257de0f0dfae8367fffcd49718574e26493 100644 (file)
--- 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