]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Clean up some valgrind warnings.
authorRoy Marples <roy@marples.name>
Mon, 7 Jan 2008 20:49:25 +0000 (20:49 +0000)
committerRoy Marples <roy@marples.name>
Mon, 7 Jan 2008 20:49:25 +0000 (20:49 +0000)
info.c

diff --git a/info.c b/info.c
index 0a9766cdd977e8f4c0d3fb9f587359e65aeda3c3..b44aa18a98c98996c6d929938d2b87e0cdb45346 100644 (file)
--- a/info.c
+++ b/info.c
@@ -56,11 +56,11 @@ static char *cleanmetas (const char *cstr)
        if (cstr == NULL || (len = strlen (cstr)) == 0)
                return (xstrdup (""));
 
-       n = new = xmalloc (sizeof (char) * len + 1);
+       n = new = xmalloc (sizeof (char) * len + 2);
        do
                if (*p == '\'') {
                        size_t pos = n - new;
-                       len += 3;
+                       len += 4;
                        new = xrealloc (new, sizeof (char) * len + 1);
                        n = new + pos;
                        *n++ = '\'';
@@ -72,7 +72,7 @@ static char *cleanmetas (const char *cstr)
        while (*p++);
 
        /* Terminate the sucker */
-       *n++ = '\0';
+       *n = '\0';
 
        return (new);
 }