rm: reuse strbuf for all remove_dir_recursively() calls
[gitweb.git] / config.c
index 325c3eaf9d1c9af8b0857ed1997fea1b6f237da6..03544e7a3f68f858e2fed5492a4460bd05b75602 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1889,7 +1889,7 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
         * Validate the key and while at it, lower case it for matching.
         */
        if (store_key)
-               *store_key = xmalloc(strlen(key) + 1);
+               *store_key = xmallocz(strlen(key));
 
        dot = 0;
        for (i = 0; key[i]; i++) {
@@ -1913,8 +1913,6 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
                if (store_key)
                        (*store_key)[i] = c;
        }
-       if (store_key)
-               (*store_key)[i] = 0;
 
        return 0;