@@ -444,9 +444,8 @@ int git_config_parse_parameter(const char *text,
444
444
445
445
int git_config_from_parameters (config_fn_t fn , void * data )
446
446
{
447
- const char * env = getenv (CONFIG_DATA_ENVIRONMENT );
447
+ char * env = xstrdup_or_null ( getenv (CONFIG_DATA_ENVIRONMENT ) );
448
448
int ret = 0 ;
449
- char * envw ;
450
449
const char * * argv = NULL ;
451
450
int nr = 0 , alloc = 0 ;
452
451
int i ;
@@ -460,10 +459,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
460
459
source .origin_type = CONFIG_ORIGIN_CMDLINE ;
461
460
cf = & source ;
462
461
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 ) {
467
463
ret = error (_ ("bogus format in %s" ), CONFIG_DATA_ENVIRONMENT );
468
464
goto out ;
469
465
}
@@ -477,7 +473,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
477
473
478
474
out :
479
475
free (argv );
480
- free (envw );
476
+ free (env );
481
477
cf = source .prev ;
482
478
return ret ;
483
479
}
@@ -2290,7 +2286,7 @@ int git_config_get_max_percent_split_change(void)
2290
2286
int git_config_get_fsmonitor (void )
2291
2287
{
2292
2288
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" ) );
2294
2290
2295
2291
if (core_fsmonitor && !* core_fsmonitor )
2296
2292
core_fsmonitor = NULL ;
0 commit comments