Browse Source

Bugfix: Release libudev handle when ID_MODEL doesn't match what we're looking for

Luke Dashjr 13 years ago
parent
commit
83f2db9c27
1 changed files with 3 additions and 0 deletions
  1. 3 0
      fpgautils.c

+ 3 - 0
fpgautils.c

@@ -110,7 +110,10 @@ int _serial_autodetect_udev(detectone_func_t detectone, va_list needles)
 
 		const char *model = udev_device_get_property_value(device, "ID_MODEL");
 		if (!(model && SEARCH_NEEDLES(model)))
+		{
+			udev_device_unref(device);
 			continue;
+		}
 
 		const char *devpath = udev_device_get_devnode(device);
 		if (devpath && detectone(devpath))