Explorar el Código

Merge pull request #151 from sn4kebite/htable-deadlock-fix

htable: Add missing ht_slot_unlock in ht_cell_value_add
Daniel-Constantin Mierla hace 10 años
padre
commit
b2260dcad8
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      modules/htable/ht_api.c

+ 3 - 0
modules/htable/ht_api.c

@@ -672,7 +672,10 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode,
 	}
 	/* add val if htable has an integer init value */
 	if(ht->flags!=PV_VAL_INT)
+	{
+		if(mode) ht_slot_unlock(ht, idx);
 		return NULL;
+	}
 	isval.n = ht->initval.n + val;
 	it = ht_cell_new(name, 0, &isval, hid);
 	if(it == NULL)