diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-07 21:23:12 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-07 21:23:12 -0800 |
commit | c0e783eb6e8c12d12c9dfbc62c4d5f820e6df61d (patch) | |
tree | a7c1f4a3669bd7e69d10d802942acf888e51cfa1 /env.cpp | |
parent | 399c78fbf74f0495c6b3ffd3871356c7dfdfbb13 (diff) |
Excised some halloc
Diffstat (limited to 'env.cpp')
-rw-r--r-- | env.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -769,15 +769,12 @@ int env_set( const wchar_t *key, if( val && contains( key, L"PWD", L"HOME" ) ) { - void *context = halloc( 0, 0 ); - const wchar_t *val_canonical = path_make_canonical( context, val ); - if( wcscmp( val_canonical, val ) ) - { - int res = env_set( key, val_canonical, var_mode ); - halloc_free( context ); - return res; - } - halloc_free( context ); + /* Canoncalize our path; if it changes, recurse and try again. */ + wcstring val_canonical = val; + path_make_canonical(val_canonical); + if (val != val_canonical) { + return env_set( key, val_canonical.c_str(), var_mode ); + } } if( (var_mode & ENV_USER ) && is_read_only(key) ) |