Fix some Double Free and uninitialized Memory in Switch

This commit is contained in:
Florian Märkl 2021-01-12 12:59:04 +01:00
commit 0b6e479e0b
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
3 changed files with 6 additions and 9 deletions

View file

@ -24,7 +24,7 @@ class DiscoveryManager
struct sockaddr * host_addr = nullptr;
size_t host_addr_len = 0;
uint32_t GetIPv4BroadcastAddr();
bool service_enable;
bool service_enable = false;
public:
typedef enum hoststate

View file

@ -35,19 +35,13 @@ DiscoveryManager::~DiscoveryManager()
{
// join discovery thread
if(this->service_enable)
{
SetService(false);
}
chiaki_discovery_fini(&this->discovery);
}
void DiscoveryManager::SetService(bool enable)
{
if(this->service_enable == enable)
{
return;
}
this->service_enable = enable;

View file

@ -129,8 +129,11 @@ int main(int argc, char *argv[])
// build sdl OpenGl and AV decoders graphical interface
DiscoveryManager discoverymanager = DiscoveryManager();
MainApplication app = MainApplication(&discoverymanager);
{
// scope to delete MainApplication before SDL_Quit()
MainApplication app(&discoverymanager);
app.Load();
}
CHIAKI_LOGI(log, "Quit applet");
SDL_Quit();