diff options
author | brueffer <brueffer@FreeBSD.org> | 2012-07-16 22:07:29 +0000 |
---|---|---|
committer | brueffer <brueffer@FreeBSD.org> | 2012-07-16 22:07:29 +0000 |
commit | 190886cd49923c4d351b8b7dfe61e4e6b0cb1dcb (patch) | |
tree | 8ee6f53b52dd68f7b6417f48da533c6eeda7fcb2 /sys/fs | |
parent | 48789932a65e3195492a8b43e807c492079e487c (diff) | |
download | FreeBSD-src-190886cd49923c4d351b8b7dfe61e4e6b0cb1dcb.zip FreeBSD-src-190886cd49923c4d351b8b7dfe61e4e6b0cb1dcb.tar.gz |
Simply error handling by moving the allocation of np down to where it is
actually used. While here, improve style a little.
Submitted by: mjg
MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/smbfs/smbfs_node.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index 6534688..1b727a5 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -223,17 +223,15 @@ loop: if (fap == NULL) return ENOENT; - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); - if (error) { - free(np, M_SMBNODE); - return error; - } + if (error != 0) + return (error); error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ - if (error != 0) { - free(np, M_SMBNODE); + if (error != 0) return (error); - } + + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); + vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; vp->v_data = np; np->n_vnode = vp; |