summaryrefslogtreecommitdiff
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-08-06 11:42:46 +0200
committerMax Kellermann <max@musicpd.org>2018-08-06 11:42:46 +0200
commit148c38fbb9d9852d81a0d5c0c2b7cf651957c2a2 (patch)
treeb896f780c4558189e9db8c86c467004b244d6cf6 /src/Main.cxx
parentfbfefcc0a3ad0f4454c68127e22a2dce7450088d (diff)
Main: use AtScopeExit() to delete the Instance
Diffstat (limited to 'src/Main.cxx')
-rw-r--r--src/Main.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index a5e8d70a3..c789cb913 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -502,6 +502,10 @@ MainOrThrow(int argc, char *argv[])
log_init(raw_config, options.verbose, options.log_stderr);
instance = new Instance();
+ AtScopeExit() {
+ delete instance;
+ instance = nullptr;
+ };
#ifdef ENABLE_NEIGHBOR_PLUGINS
instance->neighbors = new NeighborGlue();
@@ -713,8 +717,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
#ifndef ANDROID
SignalHandlersFinish();
#endif
- delete instance;
- instance = nullptr;
return EXIT_SUCCESS;
}