diff options
| author | Tyge Løvset <[email protected]> | 2020-08-06 23:12:44 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-08-06 23:12:44 +0200 |
| commit | 40d9a916f4d91e7562ec4c197f72ed661c84579e (patch) | |
| tree | 2c77f6740405cdc6e81271845e6ea22c5b2eb6f7 | |
| parent | 11a54d769b65b31a8a5870157079db193195ea00 (diff) | |
| download | STC-modified-40d9a916f4d91e7562ec4c197f72ed661c84579e.tar.gz STC-modified-40d9a916f4d91e7562ec4c197f72ed661c84579e.zip | |
Fixed a serious free() bug in erase()
| -rw-r--r-- | stc/cmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -336,6 +336,7 @@ ctype##_##tag##_erase_entry(ctype##_##tag* self, ctype##_##tag##_entry_t* entry) ctype##_##tag##_rawkey_t r; \
if (! hashx[i]) \
return false; \
+ ctype##_##tag##_entry_destroy(&slot[i]); \
do { /* deletion from hash table without tombstone */ \
if (++j == cap) j = 0; /* ++j; j %= cap; is slow */ \
if (! hashx[j]) \
@@ -346,7 +347,6 @@ ctype##_##tag##_erase_entry(ctype##_##tag* self, ctype##_##tag##_entry_t* entry) slot[i] = slot[j], hashx[i] = hashx[j], i = j; \
} while (true); \
hashx[i] = 0; \
- ctype##_##tag##_entry_destroy(&slot[i]); \
--self->size; \
return true; \
} \
|
