mirror of https://github.com/OpenVPN/openvpn-gui
				
				
				
			Fix memory leak in PLAP
When LogonUI unloads and reloads the PLAP dll, or when the provider is released and re-created, memory allocated for config list and groups leak. - Fix by freeing config list and groups in DeleteUI We do not call this before exiting WinMain in the GUI code, as its hard to do it safely -- have to ensure all status threads have terminated. Anyway, freeing is only cosmetic in this case. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/608/head
							parent
							
								
									828399526d
								
							
						
					
					
						commit
						aaeb8d2700
					
				| 
						 | 
				
			
			@ -466,3 +466,18 @@ BuildFileList()
 | 
			
		|||
 | 
			
		||||
    issue_warnings = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
FreeConfigList(options_t *o)
 | 
			
		||||
{
 | 
			
		||||
    connection_t *next = NULL;
 | 
			
		||||
    for (connection_t *c = o->chead; c; c = next)
 | 
			
		||||
    {
 | 
			
		||||
        next = c->next;
 | 
			
		||||
        free(c);
 | 
			
		||||
    }
 | 
			
		||||
    free(o->groups);
 | 
			
		||||
    o->groups = NULL;
 | 
			
		||||
    o->num_configs = 0;
 | 
			
		||||
    o->num_groups = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,8 @@
 | 
			
		|||
 | 
			
		||||
#include "main.h"
 | 
			
		||||
 | 
			
		||||
void BuildFileList();
 | 
			
		||||
void BuildFileList(void);
 | 
			
		||||
bool ConfigFileOptionExist(int, const char *);
 | 
			
		||||
void FreeConfigList(options_t *o);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -438,6 +438,8 @@ DeleteUI(void)
 | 
			
		|||
        dmsg(L"DeleteUI called before InitializeUI");
 | 
			
		||||
    }
 | 
			
		||||
    DetachAllOpenVPN();
 | 
			
		||||
    /* at this point all status threads have terminated -- we can safely free config list */
 | 
			
		||||
    FreeConfigList(&o);
 | 
			
		||||
    CloseSemaphore(o.session_semaphore);
 | 
			
		||||
    WSACleanup();
 | 
			
		||||
    memset (&o, 0, sizeof(o));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue