debuggers.hg

changeset 21952:266df0bf4a0d

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>
author Gianni Tedesco <gianni.tedesco@citrix.com>
date Tue Aug 03 17:34:08 2010 +0100 (2010-08-03)
parents 6b9e44cf2651
children fd99dc9ab249
files tools/blktap2/control/tap-ctl-list.c
line diff
     1.1 --- a/tools/blktap2/control/tap-ctl-list.c	Tue Aug 03 17:14:06 2010 +0100
     1.2 +++ b/tools/blktap2/control/tap-ctl-list.c	Tue Aug 03 17:34:08 2010 +0100
     1.3 @@ -385,9 +385,9 @@ void
     1.4  	struct tapdisk *tap;
     1.5  
     1.6  	for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
     1.7 -		struct tapdisk_list *tl;
     1.8 +		struct tapdisk_list *tl, *next;
     1.9  
    1.10 -		list_for_each_entry(tl, &tap->list, entry) {
    1.11 +		list_for_each_entry_safe(tl, next, &tap->list, entry) {
    1.12  			free(tl->params);
    1.13  			free(tl);
    1.14  		}