Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Clear sc_sme pointer to avoid double free.



details:   https://anonhg.NetBSD.org/src/rev/2d431a0c8384
branches:  trunk
changeset: 379651:2d431a0c8384
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 13 09:47:36 2021 +0000

description:
Clear sc_sme pointer to avoid double free.

diffstat:

 sys/dev/i2c/sdtemp.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 7021ded45648 -r 2d431a0c8384 sys/dev/i2c/sdtemp.c
--- a/sys/dev/i2c/sdtemp.c      Sun Jun 13 09:46:04 2021 +0000
+++ b/sys/dev/i2c/sdtemp.c      Sun Jun 13 09:47:36 2021 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sdtemp.c,v 1.39 2020/06/30 19:02:42 msaitoh Exp $        */
+/*      $NetBSD: sdtemp.c,v 1.40 2021/06/13 09:47:36 mlelstv Exp $        */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.39 2020/06/30 19:02:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.40 2021/06/13 09:47:36 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -405,6 +405,7 @@ sdtemp_attach(device_t parent, device_t 
 bad:
        kmem_free(sc->sc_sensor, sizeof(envsys_data_t));
        sysmon_envsys_destroy(sc->sc_sme);
+       sc->sc_sme = NULL;
 }
 
 static int



Home | Main Index | Thread Index | Old Index