summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorFrederic Cambus <fcambus@cvs.openbsd.org>2018-06-01 14:23:49 +0000
committerFrederic Cambus <fcambus@cvs.openbsd.org>2018-06-01 14:23:49 +0000
commit339fc1f783c5d15108ce962eb5a3869ea3d7179b (patch)
treec744769bfa60144d4435b6c3c7df7b3d2609c184 /sys
parent3b4e360793198a5dc5352405a4fa4059928e535f (diff)
Clear vc3_sc if the context is freed, to avoid leaving a dangling
pointer behind. Pointed out by visa@, thanks! OK visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/via.c3
-rw-r--r--sys/arch/i386/i386/via.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c
index f141272c77b..a27852922a0 100644
--- a/sys/arch/amd64/amd64/via.c
+++ b/sys/arch/amd64/amd64/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.30 2018/05/31 20:19:05 fcambus Exp $ */
+/* $OpenBSD: via.c,v 1.31 2018/06/01 14:23:48 fcambus Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -102,6 +102,7 @@ viac3_crypto_setup(void)
vc3_sc->sc_cid = crypto_get_driverid(0);
if (vc3_sc->sc_cid < 0) {
free(vc3_sc, M_DEVBUF, sizeof(*vc3_sc));
+ vc3_sc = NULL;
return;
}
diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c
index bdea32fe6bc..1c1ef7d7ad2 100644
--- a/sys/arch/i386/i386/via.c
+++ b/sys/arch/i386/i386/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.44 2018/05/31 20:19:05 fcambus Exp $ */
+/* $OpenBSD: via.c,v 1.45 2018/06/01 14:23:48 fcambus Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -103,6 +103,7 @@ viac3_crypto_setup(void)
vc3_sc->sc_cid = crypto_get_driverid(0);
if (vc3_sc->sc_cid < 0) {
free(vc3_sc, M_DEVBUF, sizeof(*vc3_sc));
+ vc3_sc = NULL;
return;
}