summaryrefslogtreecommitdiff
path: root/cmd/lsbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/lsbus.c')
-rw-r--r--cmd/lsbus.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/lsbus.c b/cmd/lsbus.c
index a3d4eef..2cbe334 100644
--- a/cmd/lsbus.c
+++ b/cmd/lsbus.c
@@ -446,7 +446,8 @@ int main(int argc, char *argv[])
show_options |= SHOW_DEVICES;
if (bus_to_print != NULL) {
- if (!(strcmp(bus_to_print, "pci"))) {
+ if ((!(strcmp(bus_to_print, "pci"))) &&
+ (show_options & SHOW_DEVICES)) {
pacc = (struct pci_access *)calloc(1, sizeof(struct pci_access));
pacc->pci_id_file_name = pci_id_file;
pacc->numeric_ids = 0;
@@ -455,8 +456,12 @@ int main(int argc, char *argv[])
} else
retval = print_sysfs_buses();
- if (bus_to_print != NULL)
- if (!(strcmp(bus_to_print, "pci")))
+ if (bus_to_print != NULL) {
+ if ((!(strcmp(bus_to_print, "pci"))) &&
+ (show_options & SHOW_DEVICES)) {
pci_free_name_list(pacc);
+ free (pacc);
+ }
+ }
exit(retval);
}