diff options
author | nate <nate@FreeBSD.org> | 1996-08-05 20:52:30 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1996-08-05 20:52:30 +0000 |
commit | 0eba1141e30b067e20ad21832bb771d62fb30fe3 (patch) | |
tree | b4f7374371b5e62d928e779a4627fa20dee93aa3 /sys/compat/linux/linux_util.c | |
parent | 6ebc9995b2c723169639a7a38607eaa8d134e3ec (diff) | |
download | FreeBSD-src-0eba1141e30b067e20ad21832bb771d62fb30fe3.zip FreeBSD-src-0eba1141e30b067e20ad21832bb771d62fb30fe3.tar.gz |
Fix memory leak bug in the path parsing code which never released it's
buffer in certain error conditions. Sync up the code to that in NetBSD
where applicable.
Reviewed by: Gary Jennejohn <garyj@munich.netsurf.de>
Submitted by: Michael Smith <msmith@atrad.adelaide.edu.au>
Obtained from: NetBSD sources
Diffstat (limited to 'sys/compat/linux/linux_util.c')
-rw-r--r-- | sys/compat/linux/linux_util.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index 1785fd3..bc4efdd 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp - * $Id$ + * $Id: linux_util.c,v 1.1 1996/03/02 19:38:02 peter Exp $ */ #include <sys/param.h> @@ -146,18 +146,18 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag) } if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { - goto done; + goto bad; } if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) != 0) { - goto done; + goto bad; } if (vat.va_fsid == vatroot.va_fsid && vat.va_fileid == vatroot.va_fileid) { error = ENOENT; - goto done; + goto bad; } } @@ -170,10 +170,14 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag) free(buf, M_TEMP); } - -done: vrele(nd.ni_vp); if (!cflag) vrele(ndroot.ni_vp); return error; + +bad: + vrele(ndroot.ni_vp); + vrele(nd.ni_vp); + free(buf, M_TEMP); + return error; } |