Commit d436beb7e2efd6cfc6db1bbe2a7b20ca016a2089

Kano 2013-04-29T00:04:35

usbutils remove_in_use missing prev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/usbutils.c b/usbutils.c
index bfe90ac..9d4c8eb 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -878,9 +878,10 @@ static void remove_in_use(uint8_t bus_number, uint8_t device_address)
 		if (in_use_tmp->in_use.bus_number == (int)bus_number &&
 		    in_use_tmp->in_use.device_address == (int)device_address) {
 			found = true;
-			if (in_use_tmp == in_use_head)
+			if (in_use_tmp == in_use_head) {
 				in_use_head = in_use_head->next;
-			else {
+				in_use_head->prev = NULL;
+			} else {
 				in_use_tmp->prev->next = in_use_tmp->next;
 				if (in_use_tmp->next)
 					in_use_tmp->next->prev = in_use_tmp->prev;