summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2011-08-03 18:35:11 -0400
committerAdam Jackson <ajax@redhat.com>2011-08-03 18:35:11 -0400
commit7bfc4f806d51b85e7ae069dd6deaf0b48326ed22 (patch)
tree4faa97f399ea9b9cdcb019b3f6689cfccad15a66 /src
parentf9159b97834ba4b4e42a07953a33866e7ac90dbd (diff)
downloadlibpciaccess-7bfc4f806d51b85e7ae069dd6deaf0b48326ed22.tar.gz
libpciaccess-7bfc4f806d51b85e7ae069dd6deaf0b48326ed22.tar.bz2
libpciaccess-7bfc4f806d51b85e7ae069dd6deaf0b48326ed22.zip
linux: Fix a crash in populate_devices
If scandir returns -1, the 'devices' array won't be initialized, and attempting to free() it will crash. Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/linux_sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
index bbd4dfa..2085ffb 100644
--- a/src/linux_sysfs.c
+++ b/src/linux_sysfs.c
@@ -122,7 +122,7 @@ scan_sys_pci_filter( const struct dirent * d )
int
populate_entries( struct pci_system * p )
{
- struct dirent ** devices;
+ struct dirent ** devices = NULL;
int n;
int i;
int err = 0;