Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen All error path must go through the free functio...



details:   https://anonhg.NetBSD.org/src/rev/11e540898aea
branches:  trunk
changeset: 779834:11e540898aea
user:      enami <enami%NetBSD.org@localhost>
date:      Thu Jun 21 23:29:23 2012 +0000

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

diffstat:

 lib/libc/gen/getcwd.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r bb69edd9ae62 -r 11e540898aea lib/libc/gen/getcwd.c
--- a/lib/libc/gen/getcwd.c     Thu Jun 21 21:35:25 2012 +0000
+++ b/lib/libc/gen/getcwd.c     Thu Jun 21 23:29:23 2012 +0000
@@ -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 @@
                }
                n = readlink(resolved, wbuf[idx], sizeof(wbuf[0]) - 1);
                if (n < 0)
-                       return (NULL);
+                       goto out;
                if (n == 0) {
                        errno = ENOENT;
                        goto out;



Home | Main Index | Thread Index | Old Index