Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > c3c544c0ee76ce732ab271802a1d8a10 > files > 2

usbutils-006-4.fc18.src.rpm

diff --git a/lsusb-t.c b/lsusb-t.c
index 074dafb..3e29072 100644
--- a/lsusb-t.c
+++ b/lsusb-t.c
@@ -210,8 +210,13 @@ static void read_sysfs_file_string(const char *d_name, const char *file, char *b
 
 static void append_dev_interface(struct usbinterface *i, struct usbinterface *new)
 {
-	while (i->next)
+	while (i->next) {
+		if (i == new)
+			return;
 		i = i->next;
+	}
+		if (i == new)
+			return;
 	i->next = new;
 }
 
@@ -230,8 +235,13 @@ static void append_businterface(unsigned int busnum, struct usbinterface *new)
 		if (b->busnum == busnum) {
 			i = b->first_interface;
 			if (i) {
-				while (i->next)
+				while (i->next) {
+					if (i == new)
+						return;
 					i = i->next;
+				}
+				if (i == new)
+					return;
 				i->next = new;
 			} else
 				b->first_interface = new;