Merge branch 'hv/autosquash-config'
[gitweb.git] / path.c
diff --git a/path.c b/path.c
index e32c61c2fdb7fa6dcfe66adabe4f51f849b3f0ff..a2c9d1e24afb9d1250c846791607c49d82e9565e 100644 (file)
--- a/path.c
+++ b/path.c
@@ -354,6 +354,8 @@ char *expand_user_path(const char *path)
                size_t username_len = first_slash - username;
                if (username_len == 0) {
                        const char *home = getenv("HOME");
+                       if (!home)
+                               goto return_null;
                        strbuf_add(&user_path, home, strlen(home));
                } else {
                        struct passwd *pw = getpw_str(username, username_len);