summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2013-01-09 17:10:56 +0100
committerKay Sievers <kay@vrfy.org>2013-01-09 17:14:40 +0100
commit3c123e0899b56c0587db36420da5e049c56d9e19 (patch)
tree79c1d33686cb93bc5e2a4f46f743e884b4d7538f /src/udev
parent9096ad367f6d6072ea29fa5255e968eb84ad9a3d (diff)
udev: don't call fclose on NULL in is_pci_multifunction
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-builtin-net_id.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 1975c6d62c..7c9564f4cd 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -136,7 +136,7 @@ static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) {
/* read the 256 bytes PCI configuration space to check the multi-function bit */
static bool is_pci_multifunction(struct udev_device *dev) {
char filename[256];
- FILE *f;
+ FILE *f = NULL;
char config[64];
bool multi = false;
@@ -151,7 +151,8 @@ static bool is_pci_multifunction(struct udev_device *dev) {
if ((config[PCI_HEADER_TYPE] & 0x80) != 0)
multi = true;
out:
- fclose(f);
+ if(f)
+ fclose(f);
return multi;
}