[subset] fix memory leak when map insert fails.

This commit is contained in:
Garret Rieger 2021-03-29 16:39:44 -07:00
parent 2397689387
commit 8741914a80
2 changed files with 12 additions and 5 deletions

View File

@ -699,7 +699,14 @@ struct Script
if (c->visitedScript (this)) return; if (c->visitedScript (this)) return;
if (!c->script_langsys_map->has (script_index)) if (!c->script_langsys_map->has (script_index))
c->script_langsys_map->set (script_index, hb_set_create ()); {
hb_set_t* empty_set = hb_set_create ();
c->script_langsys_map->set (script_index, empty_set);
if (!c->script_langsys_map->has (script_index)) {
hb_set_destroy (empty_set);
return;
}
}
unsigned langsys_count = get_lang_sys_count (); unsigned langsys_count = get_lang_sys_count ();
if (has_default_lang_sys ()) if (has_default_lang_sys ())