Commit 7225e919 authored by Max Kellermann's avatar Max Kellermann

db/DatabaseSong: use AtScopeExit()

parent 7a185f1e
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "Interface.hxx" #include "Interface.hxx"
#include "DetachedSong.hxx" #include "DetachedSong.hxx"
#include "storage/StorageInterface.hxx" #include "storage/StorageInterface.hxx"
#include "util/ScopeExit.hxx"
#include <assert.h> #include <assert.h>
...@@ -46,8 +47,7 @@ DatabaseDetachSong(const Database &db, const Storage &storage, const char *uri) ...@@ -46,8 +47,7 @@ DatabaseDetachSong(const Database &db, const Storage &storage, const char *uri)
const LightSong *tmp = db.GetSong(uri); const LightSong *tmp = db.GetSong(uri);
assert(tmp != nullptr); assert(tmp != nullptr);
DetachedSong *song = new DetachedSong(DatabaseDetachSong(storage, AtScopeExit(&db, tmp) { db.ReturnSong(tmp); };
*tmp));
db.ReturnSong(tmp); return new DetachedSong(DatabaseDetachSong(storage, *tmp));
return song;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment