@@ -444,9 +444,8 @@ int git_config_parse_parameter(const char *text,
444444
445445int git_config_from_parameters (config_fn_t fn , void * data )
446446{
447- const char * env = getenv (CONFIG_DATA_ENVIRONMENT );
447+ char * env = xstrdup_or_null ( getenv (CONFIG_DATA_ENVIRONMENT ) );
448448 int ret = 0 ;
449- char * envw ;
450449 const char * * argv = NULL ;
451450 int nr = 0 , alloc = 0 ;
452451 int i ;
@@ -460,10 +459,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
460459 source .origin_type = CONFIG_ORIGIN_CMDLINE ;
461460 cf = & source ;
462461
463- /* sq_dequote will write over it */
464- envw = xstrdup (env );
465-
466- if (sq_dequote_to_argv (envw , & argv , & nr , & alloc ) < 0 ) {
462+ if (sq_dequote_to_argv (env , & argv , & nr , & alloc ) < 0 ) {
467463 ret = error (_ ("bogus format in %s" ), CONFIG_DATA_ENVIRONMENT );
468464 goto out ;
469465 }
@@ -477,7 +473,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
477473
478474out :
479475 free (argv );
480- free (envw );
476+ free (env );
481477 cf = source .prev ;
482478 return ret ;
483479}
@@ -2290,7 +2286,7 @@ int git_config_get_max_percent_split_change(void)
22902286int git_config_get_fsmonitor (void )
22912287{
22922288 if (git_config_get_pathname ("core.fsmonitor" , & core_fsmonitor ))
2293- core_fsmonitor = getenv ("GIT_TEST_FSMONITOR" );
2289+ core_fsmonitor = xstrdup_or_null ( getenv ("GIT_TEST_FSMONITOR" ) );
22942290
22952291 if (core_fsmonitor && !* core_fsmonitor )
22962292 core_fsmonitor = NULL ;
0 commit comments