Module Name:    src
Committed By:   enami
Date:           Thu Jun 21 23:29:23 UTC 2012

Modified Files:
        src/lib/libc/gen: getcwd.c

Log Message:
All error path must go through the free function call after an
allocation of resolved path might succeeded.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/gen/getcwd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/getcwd.c
diff -u src/lib/libc/gen/getcwd.c:1.52 src/lib/libc/gen/getcwd.c:1.53
--- src/lib/libc/gen/getcwd.c:1.52	Thu Jun 21 21:13:07 2012
+++ src/lib/libc/gen/getcwd.c	Thu Jun 21 23:29:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getcwd.c,v 1.52 2012/06/21 21:13:07 christos Exp $	*/
+/*	$NetBSD: getcwd.c,v 1.53 2012/06/21 23:29:23 enami Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)getcwd.c	8.5 (Berkeley) 2/7/95";
 #else
-__RCSID("$NetBSD: getcwd.c,v 1.52 2012/06/21 21:13:07 christos Exp $");
+__RCSID("$NetBSD: getcwd.c,v 1.53 2012/06/21 23:29:23 enami Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -183,7 +183,7 @@ loop:
 		}
 		n = readlink(resolved, wbuf[idx], sizeof(wbuf[0]) - 1);
 		if (n < 0)
-			return (NULL);
+			goto out;
 		if (n == 0) {
 			errno = ENOENT;
 			goto out;

Reply via email to