--- linux-2.4.32-ld4/net/ipv4/netfilter/ip_set.c	2006-01-12 10:09:22.000000000 +0100
+++ linux-2.4.32-ld5/net/ipv4/netfilter/ip_set.c	2006-01-30 19:53:51.000000000 +0100
@@ -935,6 +935,20 @@
 			return -EBUSY;
 		ip_set_destroy_set(index);
 	} else {
+		struct ip_set *set;
+		for (i = 0; i < ip_set_max; i++) {
+			set = ip_set_list[i];
+			if (set != NULL ) {
+				write_lock_bh(&ip_set_lock);
+				FOREACH_HASH_RW_DO(__set_hash_del_byid, set->id);
+				if (set->binding != IP_SET_INVALID_ID) {
+					__ip_set_put(set->binding);
+					set->binding = IP_SET_INVALID_ID;
+				}
+				write_unlock_bh(&ip_set_lock);
+			}
+		}
+
 		for (i = 0; i < ip_set_max; i++) {
 			if (ip_set_list[i] != NULL 
 			    && (atomic_read(&ip_set_list[i]->ref)))