diff options
author | Keith Packard <keithp@keithp.com> | 2009-09-17 17:38:56 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-09-17 17:40:05 -0700 |
commit | cdbdfaf61c05d0d18eae6815b10666f93162148f (patch) | |
tree | 2db6199af70353005d334b22431c1b48e43f122f | |
parent | 42b879a203c1c16daa9d0c610c6a217ead7a5829 (diff) |
Free return value from scandir instead of leaking it.
Scandir is defined to return pointers to malloc'd storage, so make
sure that memory is nicely freed.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/linux_sysfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c index 02fbd13..85095b3 100644 --- a/src/linux_sysfs.c +++ b/src/linux_sysfs.c @@ -213,6 +213,10 @@ populate_entries( struct pci_system * p ) } } + for (i = 0; i < n; i++) + free(devices[i]); + free(devices); + if (err) { free(p->devices); p->devices = NULL; |