From 4159477e4398543449eb38850b0464af9a3f9f9d Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Wed, 24 Jul 2019 15:32:12 +0200 Subject: [PATCH] libobs: Don't leak dynamic library references --- libobs/obs-windows.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libobs/obs-windows.c b/libobs/obs-windows.c index 0bb1e401d..70e17f2d1 100644 --- a/libobs/obs-windows.c +++ b/libobs/obs-windows.c @@ -183,6 +183,7 @@ static void log_aero(void) composition_enabled = (dwm_is_composition_enabled_t)GetProcAddress( dwm, "DwmIsCompositionEnabled"); if (!composition_enabled) { + FreeLibrary(dwm); return; } @@ -832,10 +833,13 @@ void reset_win32_symbol_paths(void) (void *)GetProcAddress(mod, "SymInitializeW"); sym_set_search_path_w = (void *)GetProcAddress(mod, "SymSetSearchPathW"); - if (!sym_initialize_w || !sym_set_search_path_w) + if (!sym_initialize_w || !sym_set_search_path_w) { + FreeLibrary(mod); return; + } initialize_success = true; + // Leaks 'mod' once. } if (!initialize_success)