diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-26 12:18:31 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-26 12:18:31 +0100 |
commit | 75582d47b951ae9bf45c940a62e657831a5175c1 (patch) | |
tree | 247e13939cd41629c6860ae1e735c7cd74eaf48a /src/queue | |
parent | 28fdf1e9ed9adf28b54e3e9c7f4dd703d8cb3cdd (diff) |
SongSave: wrap DetachedSong* in std::unique_ptr
Diffstat (limited to 'src/queue')
-rw-r--r-- | src/queue/QueueSave.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/queue/QueueSave.cxx b/src/queue/QueueSave.cxx index a03d4950e..af29b62b3 100644 --- a/src/queue/QueueSave.cxx +++ b/src/queue/QueueSave.cxx @@ -89,7 +89,7 @@ queue_load_song(TextFile &file, const SongLoader &loader, return; } - DetachedSong *song; + std::unique_ptr<DetachedSong> song; if ((p = StringAfterPrefix(line, SONG_BEGIN))) { const char *uri = p; @@ -111,14 +111,11 @@ queue_load_song(TextFile &file, const SongLoader &loader, const char *uri = endptr + 1; - song = new DetachedSong(uri); + song = std::make_unique<DetachedSong>(uri); } - if (!playlist_check_translate_song(*song, nullptr, loader)) { - delete song; + if (playlist_check_translate_song(*song, nullptr, loader)) return; - } queue.Append(std::move(*song), priority); - delete song; } |