Skip to content

Commit

Permalink
Fix use-after-free in klist
Browse files Browse the repository at this point in the history
  • Loading branch information
tecywiz121 committed Nov 24, 2016
1 parent 884239d commit 57ddf78
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@
return kl; \
} \
SCOPE void kl_destroy_##name(kl_##name##_t *kl) { \
kl1_##name *p; \
for (p = kl->head; p != kl->tail; p = p->next) \
kl1_##name *p, *next_p; \
for (p = kl->head; p != kl->tail; p = next_p){ \
next_p = p->next; \
kmp_free(name, kl->mp, p); \
} \
kmp_free(name, kl->mp, p); \
kmp_destroy(name, kl->mp); \
free(kl); \
Expand Down

0 comments on commit 57ddf78

Please sign in to comment.