From 47b95b0f230b7bad5090d88649c76f570ff26f40 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Thu, 23 Jun 2011 21:59:54 +0000 Subject: 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@ --- sys/nnpfs/nnpfs_syscalls-common.c | 3 ++- sys/nnpfs/nnpfs_vfsops-common.c | 6 ++++-- sys/nnpfs/nnpfs_vnodeops-common.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'sys') 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; } -- cgit v1.2.3