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

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