diff --git a/builtin/config.c b/builtin/config.c index 97b58c4aea..752d0c65d7 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -595,7 +595,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) int nongit = !startup_info->have_repository; char *value; - given_config_source.file = getenv(CONFIG_ENVIRONMENT); + given_config_source.file = xstrdup_or_null(getenv(CONFIG_ENVIRONMENT)); argc = parse_options(argc, argv, prefix, builtin_config_options, builtin_config_usage,