aboutsummaryrefslogtreecommitdiffstats
path: root/src/ConfigPath.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ConfigPath.cxx')
-rw-r--r--src/ConfigPath.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx
index 2f3f3ad23..b88de3934 100644
--- a/src/ConfigPath.cxx
+++ b/src/ConfigPath.cxx
@@ -99,12 +99,11 @@ ParsePath(const char *path, Error &error)
++path;
} else {
const char *slash = strchr(path, '/');
- char *user = slash != nullptr
- ? g_strndup(path, slash - path)
- : g_strdup(path);
-
- home = GetHome(user, error);
- g_free(user);
+ const char *end = slash == nullptr
+ ? path + strlen(path)
+ : slash;
+ const std::string user(path, end);
+ home = GetHome(user.c_str(), error);
if (slash == nullptr)
return home;