Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Don't leak memory on failure in uvm_pglistalloc_contig.



details:   https://anonhg.NetBSD.org/src/rev/1ea10c2c56e2
branches:  trunk
changeset: 329307:1ea10c2c56e2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon May 19 05:24:29 2014 +0000

description:
Don't leak memory on failure in uvm_pglistalloc_contig.

Free pages like uvm_pglistalloc_simple does.

Discovered by code inspection.

diffstat:

 sys/uvm/uvm_pglist.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 83dd246f6316 -r 1ea10c2c56e2 sys/uvm/uvm_pglist.c
--- a/sys/uvm/uvm_pglist.c      Mon May 19 03:18:57 2014 +0000
+++ b/sys/uvm/uvm_pglist.c      Mon May 19 05:24:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pglist.c,v 1.63 2013/09/15 15:54:23 martin Exp $   */
+/*     $NetBSD: uvm_pglist.c,v 1.64 2014/05/19 05:24:29 riastradh Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.63 2013/09/15 15:54:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.64 2014/05/19 05:24:29 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -354,6 +354,8 @@
 
        uvm_kick_pdaemon();
        mutex_spin_exit(&uvm_fpageqlock);
+       if (error)
+               uvm_pglistfree(rlist);
        return (error);
 }
 



Home | Main Index | Thread Index | Old Index