translate-all: Prevent null-pointer dereference possibility in tb_clean_internal()

This commit is contained in:
Lioncash 2018-03-15 23:31:47 -04:00
parent f476e4b598
commit 1a1a187292
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -174,11 +174,11 @@ static void cpu_gen_init(struct uc_struct *uc)
static void tb_clean_internal(struct uc_struct *uc, int i, void** lp)
{
if (i == 0 || lp == 0) {
if (i == 0 || lp == NULL) {
return;
}
tb_clean_internal(uc, i-1, (void*)(((char*)*lp) + ((0 >> (i * V_L2_BITS)) & (V_L2_SIZE - 1))));
if (lp && *lp) {
tb_clean_internal(uc, i-1, (void*)(((char*)*lp) + ((0 >> (i * V_L2_BITS)) & (V_L2_SIZE - 1))));
g_free(*lp);
}
}