mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-29 09:30:46 +02:00
util/hash.c: fix use after free (not quite)
Dereference of 'h' after calling freeMagic(h) Found while putting in cast. Initially this is what was thought however.... freeMagic() has this one allocation to free latency, which is a matter to resolve another day.
This commit is contained in:
committed by
Tim Edwards
parent
fadd2d98b4
commit
bbc52ecd41
+2
-1
@@ -692,9 +692,10 @@ HashKill(table)
|
||||
for (hp = table->ht_table, hend = &hp[table->ht_size]; hp < hend; hp++)
|
||||
for (h = *hp; h != NIL; h = h->h_next)
|
||||
{
|
||||
const void *p = h->h_key.h_ptr;
|
||||
freeMagic((char *) h);
|
||||
if (killFn)
|
||||
(*killFn)(h->h_key.h_ptr);
|
||||
(*killFn)((void *)p);
|
||||
}
|
||||
freeMagic((char *) table->ht_table);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user