This has not caused crashes because generally use after free is OK
provided nothing else is going on. However the patch makes things
correct. It also allows us to use heap poisoning feature of valgrind on
tools linking to libblktapctl.
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
struct tapdisk *tap;
for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
- struct tapdisk_list *tl;
+ struct tapdisk_list *tl, *next;
- list_for_each_entry(tl, &tap->list, entry) {
+ list_for_each_entry_safe(tl, next, &tap->list, entry) {
free(tl->params);
free(tl);
}