summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-11-09 00:04:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-11-09 00:04:15 +0000
commitdb176529529c142333f668f2c1334753f7f406bf (patch)
treed9e55d415552e5929ab915f009212328fd3f4063 /tools
parent118f08c948b7e90066f5340c87bd3f356f696c51 (diff)
Include checks for mmap() returning NULL
Diffstat (limited to 'tools')
-rw-r--r--tools/csr.c2
-rw-r--r--tools/oui.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/csr.c b/tools/csr.c
index 698122dc..3f671740 100644
--- a/tools/csr.c
+++ b/tools/csr.c
@@ -2697,7 +2697,7 @@ int psr_read(const char *filename)
}
map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
- if (map == MAP_FAILED) {
+ if (!map || map == MAP_FAILED) {
err = -errno;
goto close;
}
diff --git a/tools/oui.c b/tools/oui.c
index 0a1d67bc..6ebf91a5 100644
--- a/tools/oui.c
+++ b/tools/oui.c
@@ -65,7 +65,7 @@ char *ouitocomp(const char *oui)
memset(str, 0, 128);
map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
- if (map == MAP_FAILED) {
+ if (!map || map == MAP_FAILED) {
free(str);
close(fd);
return NULL;