summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2011-06-23 21:59:54 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2011-06-23 21:59:54 +0000
commit47b95b0f230b7bad5090d88649c76f570ff26f40 (patch)
treefd5a5fa42d8c9ac0919ff1219d6ecc5e1b398a93 /sys
parent97de893e67591f901a2727fc0ff531382168da4a (diff)
free(null) ist verboten in the kernel.
The addition of M_CANFAIL here made it possible (if rather unlikely) that we'd fail and goto done, where we would free(NULL). protect the free with a null check to prevent this. ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/nnpfs/nnpfs_syscalls-common.c3
-rw-r--r--sys/nnpfs/nnpfs_vfsops-common.c6
-rw-r--r--sys/nnpfs/nnpfs_vnodeops-common.c3
3 files changed, 8 insertions, 4 deletions
diff --git a/sys/nnpfs/nnpfs_syscalls-common.c b/sys/nnpfs/nnpfs_syscalls-common.c
index fb119c64013..1edc9c13c02 100644
--- a/sys/nnpfs/nnpfs_syscalls-common.c
+++ b/sys/nnpfs/nnpfs_syscalls-common.c
@@ -573,7 +573,8 @@ remote_pioctl (d_thread_t *p,
error = copyout(msg2->msg, vice_ioctl->out, len);
}
done:
- free(msg, M_TEMP);
+ if (msg != NULL)
+ free(msg, M_TEMP);
return error;
}
diff --git a/sys/nnpfs/nnpfs_vfsops-common.c b/sys/nnpfs/nnpfs_vfsops-common.c
index 563f1667b0d..08434ff1f65 100644
--- a/sys/nnpfs/nnpfs_vfsops-common.c
+++ b/sys/nnpfs/nnpfs_vfsops-common.c
@@ -219,8 +219,10 @@ nnpfs_mount_common(struct mount *mp,
goto done;
error = nnpfs_mount_common_sys (mp, path, data, ndp, p);
done:
- free(data, M_TEMP);
- free(path, M_TEMP);
+ if (data)
+ free(data, M_TEMP);
+ if (path)
+ free(path, M_TEMP);
return(error);
}
diff --git a/sys/nnpfs/nnpfs_vnodeops-common.c b/sys/nnpfs/nnpfs_vnodeops-common.c
index c46539d18d2..daa5800537b 100644
--- a/sys/nnpfs/nnpfs_vnodeops-common.c
+++ b/sys/nnpfs/nnpfs_vnodeops-common.c
@@ -955,7 +955,8 @@ nnpfs_symlink_common(struct vnode *dvp,
error = ((struct nnpfs_message_wakeup *) msg)->error;
done:
- free(msg, M_TEMP);
+ if (msg)
+ free(msg, M_TEMP);
return error;
}