Fixed reg_unload: ignore empty root_key

(cherry picked from commit 327935dfaf)
This commit is contained in:
Armin Novak 2022-01-10 17:04:49 +01:00
parent 7f57ce1ac0
commit 0d227b5019

View File

@ -459,17 +459,19 @@ static void reg_unload(Reg* reg)
RegKey* pKey;
WINPR_ASSERT(reg);
WINPR_ASSERT(reg->root_key);
pKey = reg->root_key->subkeys;
while (pKey != NULL)
if (reg->root_key)
{
RegKey* pKeyNext = pKey->next;
reg_unload_key(reg, pKey);
pKey = pKeyNext;
}
pKey = reg->root_key->subkeys;
free(reg->root_key);
while (pKey != NULL)
{
RegKey* pKeyNext = pKey->next;
reg_unload_key(reg, pKey);
pKey = pKeyNext;
}
free(reg->root_key);
}
}
Reg* reg_open(BOOL read_only)