Blame SOURCES/lshw-B.02.18-scandir.patch

66f3ee
diff --git a/src/core/abi.cc b/src/core/abi.cc
66f3ee
index 76c664c..b5bd9c9 100644
66f3ee
--- a/src/core/abi.cc
66f3ee
+++ b/src/core/abi.cc
66f3ee
@@ -36,13 +36,15 @@ bool scan_abi(hwNode & system)
66f3ee
     struct dirent **namelist;
66f3ee
 
66f3ee
     n = scandir(".", &namelist, selectfile, alphasort);
66f3ee
-    for(i=0; i
66f3ee
-    {
66f3ee
-      system.addCapability(namelist[i]->d_name);
66f3ee
-      free(namelist[i]);
66f3ee
+    if (n > 0) {
66f3ee
+      for(i=0; i
66f3ee
+	{
66f3ee
+	  system.addCapability(namelist[i]->d_name);
66f3ee
+	  free(namelist[i]);
66f3ee
+	}
66f3ee
+      if(namelist)
66f3ee
+	free(namelist);
66f3ee
     }
66f3ee
-    if(namelist)
66f3ee
-      free(namelist);
66f3ee
   }
66f3ee
 
66f3ee
   popd();