aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap2
diff options
context:
space:
mode:
authorGianni Tedesco <gianni.tedesco@citrix.com>2010-08-03 17:34:08 +0100
committerGianni Tedesco <gianni.tedesco@citrix.com>2010-08-03 17:34:08 +0100
commit27d3eb3d9953399d78b648efac6565e92613cae1 (patch)
treedb85c50091ed42928ec29e32a26ad1c88a3ff2ab /tools/blktap2
parent0e05a47ca4e680f7ed8d5ac5bce73e9caba737ac (diff)
downloadxen-27d3eb3d9953399d78b648efac6565e92613cae1.tar.gz
xen-27d3eb3d9953399d78b648efac6565e92613cae1.tar.bz2
xen-27d3eb3d9953399d78b648efac6565e92613cae1.zip
libblktapctl: fix use-after-free bug
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>
Diffstat (limited to 'tools/blktap2')
-rw-r--r--tools/blktap2/control/tap-ctl-list.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/blktap2/control/tap-ctl-list.c b/tools/blktap2/control/tap-ctl-list.c
index 55de3e772d..1497270874 100644
--- a/tools/blktap2/control/tap-ctl-list.c
+++ b/tools/blktap2/control/tap-ctl-list.c
@@ -385,9 +385,9 @@ _tap_ctl_free_tapdisks(struct tapdisk *tapv, int n_taps)
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);
}