summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2015-08-12 05:39:36 +0000
committermlarkin <mlarkin@openbsd.org>2015-08-12 05:39:36 +0000
commit54b0a103f714765fd49fe14128eb22f54a81790c (patch)
tree63a98ec0e5e948356b26466011ecbd1c9ba21427
parentIncorrect comparison when accessing cpuid extended function 0x80000007. (diff)
downloadwireguard-openbsd-54b0a103f714765fd49fe14128eb22f54a81790c.tar.xz
wireguard-openbsd-54b0a103f714765fd49fe14128eb22f54a81790c.zip
Fix a free of an uninitialized variable in an error path.
ok miod@ found by Maxime Villard / Brainy Code Scanner. thanks.
-rw-r--r--sys/arch/hppa/dev/apic.c8
-rw-r--r--sys/arch/hppa64/dev/apic.c8
2 files changed, 6 insertions, 10 deletions
diff --git a/sys/arch/hppa/dev/apic.c b/sys/arch/hppa/dev/apic.c
index d287d182a16..7196b9207a9 100644
--- a/sys/arch/hppa/dev/apic.c
+++ b/sys/arch/hppa/dev/apic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apic.c,v 1.16 2014/12/09 06:58:28 doug Exp $ */
+/* $OpenBSD: apic.c,v 1.17 2015/08/12 05:39:36 mlarkin Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -170,10 +170,8 @@ apic_intr_establish(void *v, pci_intr_handle_t ih,
return (NULL);
aiv = malloc(sizeof(struct apic_iv), M_DEVBUF, M_NOWAIT);
- if (aiv == NULL) {
- free(cnt, M_DEVBUF, 0);
- return NULL;
- }
+ if (aiv == NULL)
+ return (NULL);
cnt = malloc(sizeof(struct evcount), M_DEVBUF, M_NOWAIT);
if (!cnt) {
diff --git a/sys/arch/hppa64/dev/apic.c b/sys/arch/hppa64/dev/apic.c
index be4410f3671..5f087a8481f 100644
--- a/sys/arch/hppa64/dev/apic.c
+++ b/sys/arch/hppa64/dev/apic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apic.c,v 1.8 2014/12/09 06:58:28 doug Exp $ */
+/* $OpenBSD: apic.c,v 1.9 2015/08/12 05:39:36 mlarkin Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -172,10 +172,8 @@ apic_intr_establish(void *v, pci_intr_handle_t ih,
return (NULL);
aiv = malloc(sizeof(struct apic_iv), M_DEVBUF, M_NOWAIT);
- if (aiv == NULL) {
- free(cnt, M_DEVBUF, 0);
- return NULL;
- }
+ if (aiv == NULL)
+ return (NULL);
aiv->sc = sc;
aiv->ih = ih;