Module Name: src Committed By: christos Date: Sun Sep 21 15:52:43 UTC 2014
Modified Files: src/sys/arch/hpcmips/tx: tx39icu.c Log Message: fix leak. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/hpcmips/tx/tx39icu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hpcmips/tx/tx39icu.c diff -u src/sys/arch/hpcmips/tx/tx39icu.c:1.33 src/sys/arch/hpcmips/tx/tx39icu.c:1.34 --- src/sys/arch/hpcmips/tx/tx39icu.c:1.33 Wed Mar 26 13:53:36 2014 +++ src/sys/arch/hpcmips/tx/tx39icu.c Sun Sep 21 11:52:43 2014 @@ -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 @@ tx39_poll_establish(tx_chipset_tag_t tc, 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 @@ tx39_poll_establish(tx_chipset_tag_t tc, 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); } }