diff options
author | Max Kellermann <max@musicpd.org> | 2017-02-08 09:58:40 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-02-08 09:58:40 +0100 |
commit | 7225e919fc181eb34908f6b681127a9df781a34d (patch) | |
tree | ee6a62f2b4ab7c9a3c919d08341d421c6a839d8e | |
parent | 7a185f1ead87d68ff0a2a002d8d5838e833f8ef9 (diff) |
db/DatabaseSong: use AtScopeExit()
-rw-r--r-- | src/db/DatabaseSong.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/db/DatabaseSong.cxx b/src/db/DatabaseSong.cxx index 887794d25..aadc0bee4 100644 --- a/src/db/DatabaseSong.cxx +++ b/src/db/DatabaseSong.cxx @@ -23,6 +23,7 @@ #include "Interface.hxx" #include "DetachedSong.hxx" #include "storage/StorageInterface.hxx" +#include "util/ScopeExit.hxx" #include <assert.h> @@ -46,8 +47,7 @@ DatabaseDetachSong(const Database &db, const Storage &storage, const char *uri) const LightSong *tmp = db.GetSong(uri); assert(tmp != nullptr); - DetachedSong *song = new DetachedSong(DatabaseDetachSong(storage, - *tmp)); - db.ReturnSong(tmp); - return song; + AtScopeExit(&db, tmp) { db.ReturnSong(tmp); }; + + return new DetachedSong(DatabaseDetachSong(storage, *tmp)); } |