Main: use AtScopeExit() to call NeighborGlue::Close()
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/Main.cxx
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/Main.cxx
									
									
									
									
									
								
							@@ -548,6 +548,11 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
 | 
				
			|||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
 | 
					#ifdef ENABLE_NEIGHBOR_PLUGINS
 | 
				
			||||||
	if (instance->neighbors != nullptr)
 | 
						if (instance->neighbors != nullptr)
 | 
				
			||||||
		instance->neighbors->Open();
 | 
							instance->neighbors->Open();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						AtScopeExit() {
 | 
				
			||||||
 | 
							if (instance->neighbors != nullptr)
 | 
				
			||||||
 | 
								instance->neighbors->Close();
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ZeroconfInit(raw_config, instance->event_loop);
 | 
						ZeroconfInit(raw_config, instance->event_loop);
 | 
				
			||||||
@@ -621,10 +626,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
 | 
				
			|||||||
	delete instance->client_list;
 | 
						delete instance->client_list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
 | 
					#ifdef ENABLE_NEIGHBOR_PLUGINS
 | 
				
			||||||
	if (instance->neighbors != nullptr) {
 | 
						delete instance->neighbors;
 | 
				
			||||||
		instance->neighbors->Close();
 | 
					 | 
				
			||||||
		delete instance->neighbors;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return EXIT_SUCCESS;
 | 
						return EXIT_SUCCESS;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user