Main: use AtScopeExit() to delete the Instance
This commit is contained in:
parent
fbfefcc0a3
commit
148c38fbb9
@ -502,6 +502,10 @@ MainOrThrow(int argc, char *argv[])
|
|||||||
log_init(raw_config, options.verbose, options.log_stderr);
|
log_init(raw_config, options.verbose, options.log_stderr);
|
||||||
|
|
||||||
instance = new Instance();
|
instance = new Instance();
|
||||||
|
AtScopeExit() {
|
||||||
|
delete instance;
|
||||||
|
instance = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||||
instance->neighbors = new NeighborGlue();
|
instance->neighbors = new NeighborGlue();
|
||||||
@ -713,8 +717,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
|
|||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
SignalHandlersFinish();
|
SignalHandlersFinish();
|
||||||
#endif
|
#endif
|
||||||
delete instance;
|
|
||||||
instance = nullptr;
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user