summaryrefslogtreecommitdiff
path: root/src/PlaylistFile.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-14 21:53:08 +0200
committerMax Kellermann <max@duempel.org>2013-10-14 21:53:08 +0200
commitc96b29570042eff627d5e956f5ce58630385d18f (patch)
tree546b8855512e919781123a17587332130b28409d /src/PlaylistFile.cxx
parent9067da2df8472d6c5871f075654dc0561fbb13f3 (diff)
PlaylistFile: fix memory leak
Consistently use std::string in LoadPlaylistFile().
Diffstat (limited to 'src/PlaylistFile.cxx')
-rw-r--r--src/PlaylistFile.cxx22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index b7ed10dfa..7b81d7354 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -241,27 +241,25 @@ LoadPlaylistFile(const char *utf8path, Error &error)
if (*s == 0 || *s == PLAYLIST_COMMENT)
continue;
+ std::string uri_utf8;
+
if (g_path_is_absolute(s)) {
- const auto path = Path::ToUTF8(s);
- if (path.empty())
+ uri_utf8 = Path::ToUTF8(s);
+ if (uri_utf8.empty())
continue;
- s = g_strconcat("file://", path.c_str(), NULL);
+ uri_utf8.insert(0, "file://");
} else if (!uri_has_scheme(s)) {
- const auto path = map_fs_to_utf8(s);
- if (path.empty())
+ uri_utf8 = map_fs_to_utf8(s);
+ if (uri_utf8.empty())
continue;
-
- s = g_strdup(path.c_str());
} else {
- const auto path = Path::ToUTF8(s);
- if (path.empty())
+ uri_utf8 = Path::ToUTF8(s);
+ if (uri_utf8.empty())
continue;
-
- s = g_strdup(path.c_str());
}
- contents.emplace_back(s);
+ contents.emplace_back(std::move(uri_utf8));
if (contents.size() >= playlist_max_length)
break;
}