Commit bfdbec1d87b923f886ba4ea0beb514ab41b5e611

Kano 2013-04-29T00:11:12

usbutils remove_in_use yet again

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