diff options
author | Max Kellermann <max@duempel.org> | 2010-06-01 09:10:58 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-06-01 09:59:54 +0200 |
commit | caf93d9a2c2360a5b4a1d841fb83394d6bf4fc09 (patch) | |
tree | 0bc9ab2cd488cb508e183d05cffeff54fb3995ad /src/playlist_mapper.c | |
parent | 747e945d29e847403cec928ca4a3df7f27864cfc (diff) | |
download | mpd-caf93d9a2c2360a5b4a1d841fb83394d6bf4fc09.tar.gz mpd-caf93d9a2c2360a5b4a1d841fb83394d6bf4fc09.tar.xz mpd-caf93d9a2c2360a5b4a1d841fb83394d6bf4fc09.zip |
playlist_list: playlist_list_open_path() returns input_stream
Memory leak fix. The input_stream object passed to
playlist_list_open_stream_suffix() must be closed by the caller - this
however never happens in playlist_list_open_path(), because it does
not return it to the caller.
Diffstat (limited to 'src/playlist_mapper.c')
-rw-r--r-- | src/playlist_mapper.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/playlist_mapper.c b/src/playlist_mapper.c index 3933ec194..99b322073 100644 --- a/src/playlist_mapper.c +++ b/src/playlist_mapper.c @@ -27,13 +27,15 @@ #include <assert.h> static struct playlist_provider * -playlist_open_path(const char *path_fs) +playlist_open_path(const char *path_fs, struct input_stream **is_r) { struct playlist_provider *playlist; playlist = playlist_list_open_uri(path_fs); - if (playlist == NULL) - playlist = playlist_list_open_path(path_fs); + if (playlist != NULL) + *is_r = NULL; + else + playlist = playlist_list_open_path(path_fs, is_r); return playlist; } @@ -42,7 +44,7 @@ playlist_open_path(const char *path_fs) * Load a playlist from the configured playlist directory. */ static struct playlist_provider * -playlist_open_in_playlist_dir(const char *uri) +playlist_open_in_playlist_dir(const char *uri, struct input_stream **is_r) { char *path_fs; @@ -54,7 +56,7 @@ playlist_open_in_playlist_dir(const char *uri) path_fs = g_build_filename(playlist_directory_fs, uri, NULL); - struct playlist_provider *playlist = playlist_open_path(path_fs); + struct playlist_provider *playlist = playlist_open_path(path_fs, is_r); g_free(path_fs); return playlist; @@ -64,7 +66,7 @@ playlist_open_in_playlist_dir(const char *uri) * Load a playlist from the configured music directory. */ static struct playlist_provider * -playlist_open_in_music_dir(const char *uri) +playlist_open_in_music_dir(const char *uri, struct input_stream **is_r) { char *path_fs; @@ -74,25 +76,25 @@ playlist_open_in_music_dir(const char *uri) if (path_fs == NULL) return NULL; - struct playlist_provider *playlist = playlist_open_path(path_fs); + struct playlist_provider *playlist = playlist_open_path(path_fs, is_r); g_free(path_fs); return playlist; } struct playlist_provider * -playlist_mapper_open(const char *uri) +playlist_mapper_open(const char *uri, struct input_stream **is_r) { struct playlist_provider *playlist; if (spl_valid_name(uri)) { - playlist = playlist_open_in_playlist_dir(uri); + playlist = playlist_open_in_playlist_dir(uri, is_r); if (playlist != NULL) return playlist; } if (uri_safe_local(uri)) { - playlist = playlist_open_in_music_dir(uri); + playlist = playlist_open_in_music_dir(uri, is_r); if (playlist != NULL) return playlist; } |