libobs: Fix memory leak when migrating from legacy scene item data

Before the commit 763dddbbaf, hotkeys to show and hide scene items are
distinguished by source name instead of ID. When migrating from the
legacy data structure, the pointer to the data was not released.
This commit is contained in:
Norihiro Kamae
2023-11-16 16:27:23 -05:00
committed by Ryan Foster
parent 3e6797ca5b
commit 9391ab305e
+6 -2
View File
@@ -2042,13 +2042,17 @@ static void init_hotkeys(obs_scene_t *scene, obs_sceneitem_t *item,
/* Check if legacy keys exists, migrate if necessary */
dstr_printf(&legacy, "libobs.show_scene_item.%s", name);
hotkey_array = obs_data_get_array(hotkey_data, legacy.array);
if (hotkey_array)
if (hotkey_array) {
obs_data_set_array(hotkey_data, show.array, hotkey_array);
obs_data_array_release(hotkey_array);
}
dstr_printf(&legacy, "libobs.hide_scene_item.%s", name);
hotkey_array = obs_data_get_array(hotkey_data, legacy.array);
if (hotkey_array)
if (hotkey_array) {
obs_data_set_array(hotkey_data, hide.array, hotkey_array);
obs_data_array_release(hotkey_array);
}
item->toggle_visibility = obs_hotkey_pair_register_source(
scene->source, show.array, show_desc.array, hide.array,