diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 16:50:03 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 16:50:03 -0800 |
commit | 0c9e398bef070e2841e275ce871fc1836e104711 (patch) | |
tree | 3b1025f7454b3126fcf7e4ad5196291d7d180b4b /path.cpp | |
parent | af2d348543f623e30376c54908cfd2eda99fb685 (diff) |
Change parser_t::parse_job's args array to be a local, rather than just leak it, which no longer seems to crash
Diffstat (limited to 'path.cpp')
-rw-r--r-- | path.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -328,7 +328,7 @@ bool path_get_cdpath_string(const wcstring &dir_str, wcstring &result, const env return res; } -wchar_t *path_get_cdpath( void *context, const wchar_t *dir ) +wchar_t *path_allocate_cdpath( const wchar_t *dir ) { wchar_t *res = 0; int err = ENOENT; @@ -343,7 +343,7 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir ) { if( S_ISDIR(buf.st_mode) ) { - res = halloc_wcsdup( context, dir ); + res = wcsdup(dir); } else { @@ -399,7 +399,6 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir ) if( S_ISDIR(buf.st_mode) ) { res = whole_path; - halloc_register( context, whole_path ); break; } else @@ -428,6 +427,12 @@ wchar_t *path_get_cdpath( void *context, const wchar_t *dir ) return res; } +bool path_can_get_cdpath(const wcstring &in) { + wchar_t *tmp = path_allocate_cdpath(in.c_str()); + bool result = (tmp != NULL); + free(tmp); + return result; +} wchar_t *path_get_config( void *context) { |