mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 14:03:11 -07:00
Fix some Double Free and uninitialized Memory in Switch
This commit is contained in:
parent
fc58e83e9c
commit
0b6e479e0b
3 changed files with 6 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
app.Load();
|
||||
{
|
||||
// scope to delete MainApplication before SDL_Quit()
|
||||
MainApplication app(&discoverymanager);
|
||||
app.Load();
|
||||
}
|
||||
|
||||
CHIAKI_LOGI(log, "Quit applet");
|
||||
SDL_Quit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue