Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev avoid a memory leak



details:   https://anonhg.NetBSD.org/src/rev/7f81d27dfbfb
branches:  trunk
changeset: 515814:7f81d27dfbfb
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Oct 05 13:32:23 2001 +0000

description:
avoid a memory leak

diffstat:

 sys/arch/sparc/dev/sbus.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 12469000d1c0 -r 7f81d27dfbfb sys/arch/sparc/dev/sbus.c
--- a/sys/arch/sparc/dev/sbus.c Fri Oct 05 13:32:00 2001 +0000
+++ b/sys/arch/sparc/dev/sbus.c Fri Oct 05 13:32:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbus.c,v 1.41 2001/09/26 20:53:05 eeh Exp $ */
+/*     $NetBSD: sbus.c,v 1.42 2001/10/05 13:32:23 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -709,8 +709,10 @@
                /* Change format to an `struct sbus_intr' array */
                struct sbus_intr *ip;
                ip = malloc(*np * sizeof(struct sbus_intr), M_DEVBUF, M_NOWAIT);
-               if (ip == NULL)
+               if (ip == NULL) {
+                       free(ipl, M_DEVBUF);
                        return (ENOMEM);
+               }
                for (n = 0; n < *np; n++) {
                        ip[n].sbi_pri = ipl[n];
                        ip[n].sbi_vec = 0;



Home | Main Index | Thread Index | Old Index