diff options
author | 2011-06-23 21:59:53 +0000 | |
---|---|---|
committer | 2011-06-23 21:59:53 +0000 | |
commit | 4faad2db72d78cb6502d1a7d5703950eb7973353 (patch) | |
tree | 7fd2fa9cd61bcac0dfb27a09e01cbc683d890995 | |
parent | Check for the correct flag when checking to see if the page is part of an aobj. (diff) | |
download | wireguard-openbsd-4faad2db72d78cb6502d1a7d5703950eb7973353.tar.xz wireguard-openbsd-4faad2db72d78cb6502d1a7d5703950eb7973353.zip |
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@
-rw-r--r-- | sys/nnpfs/nnpfs_syscalls-common.c | 3 | ||||
-rw-r--r-- | sys/nnpfs/nnpfs_vfsops-common.c | 6 | ||||
-rw-r--r-- | sys/nnpfs/nnpfs_vnodeops-common.c | 3 |
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; } |