Source-Changes-HG archive

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

[src/trunk]: src/sys/arch fix leak.



details:   https://anonhg.NetBSD.org/src/rev/2ba0d6f15db5
branches:  trunk
changeset: 802584:2ba0d6f15db5
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 21 15:49:21 2014 +0000

description:
fix leak.

diffstat:

 sys/arch/atari/atari/intr.c         |   8 +++++---
 sys/arch/ews4800mips/sbd/fb_sbdio.c |   5 +++--
 sys/arch/hpcmips/tx/tx39icu.c       |  16 +++++++---------
 3 files changed, 15 insertions(+), 14 deletions(-)

diffs (105 lines):

diff -r ec6015d0b4ba -r 2ba0d6f15db5 sys/arch/atari/atari/intr.c
--- a/sys/arch/atari/atari/intr.c       Sun Sep 21 15:48:29 2014 +0000
+++ b/sys/arch/atari/atari/intr.c       Sun Sep 21 15:49:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $   */
+/*     $NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $       */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.24 2014/09/21 15:49:21 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -132,8 +132,10 @@
         */
        switch (type & (AUTO_VEC|USER_VEC)) {
        case AUTO_VEC:
-               if (vector < AVEC_MIN || vector > AVEC_MAX)
+               if (vector < AVEC_MIN || vector > AVEC_MAX) {
+                       free(ih, M_DEVBUF);
                        return NULL;
+               }
                vec_list = &autovec_list[vector-1];
                hard_vec = &autovects[vector-1];
                ih->ih_intrcnt = &intrcnt_auto[vector-1];
diff -r ec6015d0b4ba -r 2ba0d6f15db5 sys/arch/ews4800mips/sbd/fb_sbdio.c
--- a/sys/arch/ews4800mips/sbd/fb_sbdio.c       Sun Sep 21 15:48:29 2014 +0000
+++ b/sys/arch/ews4800mips/sbd/fb_sbdio.c       Sun Sep 21 15:49:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb_sbdio.c,v 1.13 2014/01/31 15:41:48 tsutsui Exp $    */
+/*     $NetBSD: fb_sbdio.c,v 1.14 2014/09/21 15:50:35 christos Exp $   */
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define WIRED_FB_TLB
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.13 2014/01/31 15:41:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.14 2014/09/21 15:50:35 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,6 +154,7 @@
                ga = malloc(sizeof(struct ga), M_DEVBUF, M_NOWAIT | M_ZERO);
                if (ga == NULL) {
                        printf(":can't allocate ga memory\n");
+                       free(ri, M_DEVBUF);
                        return;
                }
                ga->reg_paddr = sa->sa_addr2;
diff -r ec6015d0b4ba -r 2ba0d6f15db5 sys/arch/hpcmips/tx/tx39icu.c
--- a/sys/arch/hpcmips/tx/tx39icu.c     Sun Sep 21 15:48:29 2014 +0000
+++ b/sys/arch/hpcmips/tx/tx39icu.c     Sun Sep 21 15:49:21 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $ */
+/*     $NetBSD: tx39icu.c,v 1.34 2014/09/21 15:52:43 christos Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.34 2014/09/21 15:52:43 christos Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -634,11 +634,9 @@
        s = splhigh();
        sc = tc->tc_intrt;
 
-       if (!(p = malloc(sizeof(struct txpoll_entry), 
-           M_DEVBUF, M_NOWAIT))) {
+       if (!(p = malloc(sizeof(*p), M_DEVBUF, M_NOWAIT | M_ZERO))) {
                panic ("tx39_poll_establish: no memory.");
        }
-       memset(p, 0, sizeof(struct txpoll_entry));
 
        p->p_fun = ih_fun;
        p->p_arg = ih_arg;
@@ -647,13 +645,13 @@
        if (!sc->sc_polling) {
                tx39clock_alarm_set(tc, 33); /* 33 msec */
                
-               if (!(sc->sc_poll_ih = 
-                   tx_intr_establish(
-                           tc, MAKEINTR(5, TX39_INTRSTATUS5_ALARMINT),
-                           IST_EDGE, level, tx39_poll_intr, sc)))  {
+               if (!(sc->sc_poll_ih = tx_intr_establish(
+                   tc, MAKEINTR(5, TX39_INTRSTATUS5_ALARMINT),
+                   IST_EDGE, level, tx39_poll_intr, sc)))  {
                        printf("tx39_poll_establish: can't hook\n");
 
                        splx(s);
+                       free(p, M_DEVBUF);
                        return (0);
                }
        }



Home | Main Index | Thread Index | Old Index