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; RegKey* pKey;
WINPR_ASSERT(reg); WINPR_ASSERT(reg);
WINPR_ASSERT(reg->root_key); if (reg->root_key)
pKey = reg->root_key->subkeys;
while (pKey != NULL)
{ {
RegKey* pKeyNext = pKey->next; pKey = reg->root_key->subkeys;
reg_unload_key(reg, pKey);
pKey = pKeyNext;
}
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) Reg* reg_open(BOOL read_only)