Source-Changes-HG archive

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

[src/trunk]: src/sys/kern plug memory leak on error.



details:   https://anonhg.NetBSD.org/src/rev/95c9a0711e14
branches:  trunk
changeset: 555286:95c9a0711e14
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Nov 13 11:59:46 2003 +0000

description:
plug memory leak on error.

diffstat:

 sys/kern/sys_pipe.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r bde7a471d89a -r 95c9a0711e14 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Thu Nov 13 10:35:40 2003 +0000
+++ b/sys/kern/sys_pipe.c       Thu Nov 13 11:59:46 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_pipe.c,v 1.45 2003/10/25 09:10:35 christos Exp $   */
+/*     $NetBSD: sys_pipe.c,v 1.46 2003/11/13 11:59:46 yamt Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.45 2003/10/25 09:10:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.46 2003/11/13 11:59:46 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -315,7 +315,7 @@
        struct pipe *pipe;
        int error;
 
-       pipe = pool_get(&pipe_pool, M_WAITOK);
+       pipe = *pipep = pool_get(&pipe_pool, M_WAITOK);
        if (pipe == NULL)
                return (ENOMEM);
 
@@ -332,7 +332,6 @@
        simple_lock_init(&pipe->pipe_slock);
        lockinit(&pipe->pipe_lock, PRIBIO | PCATCH, "pipelk", 0, 0);
 
-       *pipep = pipe;
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index