cocci: refactor common patterns to use xstrdup_or_null()
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 0f1937fd0c23da7c316540b8f9a6b05746011506..f914490e149bc10806c78cf47ee82b81b122d84f 100644 (file)
--- a/git.c
+++ b/git.c
@@ -35,8 +35,7 @@ static void save_env_before_alias(void)
        orig_cwd = xgetcwd();
        for (i = 0; i < ARRAY_SIZE(env_names); i++) {
                orig_env[i] = getenv(env_names[i]);
-               if (orig_env[i])
-                       orig_env[i] = xstrdup(orig_env[i]);
+               orig_env[i] = xstrdup_or_null(orig_env[i]);
        }
 }