From ea626368a0ebc2486a75f6baf8432e2f99091ea1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Feb 2016 10:56:37 +0100 Subject: [PATCH] queue/QueueCommands: use std::unique_ptr --- src/command/QueueCommands.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 8405d0a9f..b6a7c16dc 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -40,6 +40,7 @@ #include "util/Error.hxx" #include "fs/AllocatedPath.hxx" +#include #include #include @@ -48,14 +49,13 @@ static CommandResult AddUri(Client &client, const LocatedUri &uri, Response &r) { Error error; - DetachedSong *song = SongLoader(client).LoadSong(uri, error); + std::unique_ptr song(SongLoader(client).LoadSong(uri, error)); if (song == nullptr) return print_error(r, error); auto &partition = client.partition; unsigned id = partition.playlist.AppendSong(partition.pc, std::move(*song), error); - delete song; if (id == 0) return print_error(r, error);