Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Sep 2001 04:59:22 -0700 (PDT)
From:      Mike Potanin <potanin@mccme.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/30306: Memory leak in __getcwd
Message-ID:  <200109041159.f84BxMD67053@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         30306
>Category:       kern
>Synopsis:       Memory leak in __getcwd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 04 05:00:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mike Potanin
>Release:        4.3-RELEASE
>Organization:
asplinux
>Environment:
FreeBSD pm.asplinux.ru 4.3-RELEASE FreeBSD 4.3-RELEASE #40: Mon Sep  3 19:40:01 MSD 2001     root@pm.asplinux.ru:/usr/src/sys/compile/PM  i386
>Description:

>How-To-Repeat:
mount ... /mnt
mkdir /mnt/test
cd /mnt/test
umount -f /mnt
/bin/pwd  # Many times :-)
>Fix:
"kern/vfs_cache.c" line 540
 	buf = bp = malloc(uap->buflen, M_TEMP, M_WAITOK);
 	bp += uap->buflen - 1;
 	*bp = '\0';
 	fdp = p->p_fd;
 	slash_prefixed = 0;
 	for (vp = fdp->fd_cdir; vp != fdp->fd_rdir && vp != rootvnode;) {
 		if (vp->v_flag & VROOT) {
-			if (vp->v_mount == NULL) {	/* forced unmount */
-				free(buf, M_TEMP);
+			if (vp->v_mount == NULL)	/* forced unmount */
 				return (EBADF);
-			}
 			vp = vp->v_mount->mnt_vnodecovered;
 			continue;
 		}
 		if (vp->v_dd->v_id != vp->v_ddid) {
 			numcwdfail1++;
 			free(buf, M_TEMP);
 			return (ENOTDIR);
 		}

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109041159.f84BxMD67053>