From 3189fe02a8ac2971679441fc4f4905e4e5a8a7a7 Mon Sep 17 00:00:00 2001 From: Viktor Ivanov Date: Wed, 9 Oct 2024 23:01:20 +0900 Subject: [PATCH] Fix memory leaks (#594) --- src/enhance-filter.cpp | 2 +- src/obs-utils/obs-config-utils.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/enhance-filter.cpp b/src/enhance-filter.cpp index 556a7895..de904b8b 100644 --- a/src/enhance-filter.cpp +++ b/src/enhance-filter.cpp @@ -155,7 +155,6 @@ void enhance_filter_update(void *data, obs_data_t *settings) obs_enter_graphics(); char *effect_path = obs_module_file(BLEND_EFFECT_PATH); - gs_effect_destroy(tf->blendEffect); tf->blendEffect = gs_effect_create_from_file(effect_path, NULL); bfree(effect_path); @@ -190,6 +189,7 @@ void enhance_filter_destroy(void *data) if (tf->stagesurface) { gs_stagesurface_destroy(tf->stagesurface); } + gs_effect_destroy(tf->blendEffect); obs_leave_graphics(); tf->~enhance_filter(); bfree(tf); diff --git a/src/obs-utils/obs-config-utils.cpp b/src/obs-utils/obs-config-utils.cpp index 291dbde9..3a5d20c4 100644 --- a/src/obs-utils/obs-config-utils.cpp +++ b/src/obs-utils/obs-config-utils.cpp @@ -40,9 +40,11 @@ int getConfig(config_t **config) if (ret != CONFIG_SUCCESS) { obs_log(LOG_INFO, "Failed to open config file %s", config_file_path); + bfree(config_file_path); return OBS_BGREMOVAL_CONFIG_FAIL; } + bfree(config_file_path); return OBS_BGREMOVAL_CONFIG_SUCCESS; }