summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-11-15 00:07:06 +0000
committerderaadt <deraadt@openbsd.org>1997-11-15 00:07:06 +0000
commit6f67cc8dc670c2edf812deed4592542147de629c (patch)
treea10668acee8287f52151727f3c5578db5aa988ff
parentFixed up a VOP_UNLOCK call so that it uses the correction proc * (diff)
downloadwireguard-openbsd-6f67cc8dc670c2edf812deed4592542147de629c.tar.xz
wireguard-openbsd-6f67cc8dc670c2edf812deed4592542147de629c.zip
fix memory management errors
-rw-r--r--sys/net/encap.c7
-rw-r--r--sys/netinet/ip_ah_new.c8
-rw-r--r--sys/netinet/ip_ah_old.c8
-rw-r--r--sys/netinet/ip_esp_new.c8
-rw-r--r--sys/netinet/ip_esp_old.c8
5 files changed, 29 insertions, 10 deletions
diff --git a/sys/net/encap.c b/sys/net/encap.c
index 8244e90caf4..48267fb46e7 100644
--- a/sys/net/encap.c
+++ b/sys/net/encap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encap.c,v 1.18 1997/11/04 09:10:53 provos Exp $ */
+/* $OpenBSD: encap.c,v 1.19 1997/11/15 00:07:06 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -364,7 +364,10 @@ va_dcl
error = tdb_init(tdbp, m);
if (error)
- SENDERR(EINVAL);
+ {
+ tdb_delete(tdbp, 0);
+ SENDERR(EINVAL);
+ }
break;
diff --git a/sys/netinet/ip_ah_new.c b/sys/netinet/ip_ah_new.c
index 4365075a1f5..79c7e1d3bfc 100644
--- a/sys/netinet/ip_ah_new.c
+++ b/sys/netinet/ip_ah_new.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah_new.c,v 1.11 1997/11/04 09:11:01 provos Exp $ */
+/* $OpenBSD: ip_ah_new.c,v 1.12 1997/11/15 00:07:07 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -245,7 +245,11 @@ ah_new_zeroize(struct tdb *tdbp)
if (encdebug)
printf("ah_new_zeroize(): freeing memory\n");
#endif /* ENCDEBUG */
- FREE(tdbp->tdb_xdata, M_XDATA);
+ if (tdbp->tdb_xdata)
+ {
+ FREE(tdbp->tdb_xdata, M_XDATA);
+ tdbp->tdb_xdata = NULL;
+ }
return 0;
}
diff --git a/sys/netinet/ip_ah_old.c b/sys/netinet/ip_ah_old.c
index e04ea1456c8..3df42e315ea 100644
--- a/sys/netinet/ip_ah_old.c
+++ b/sys/netinet/ip_ah_old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah_old.c,v 1.9 1997/11/07 08:27:29 niklas Exp $ */
+/* $OpenBSD: ip_ah_old.c,v 1.10 1997/11/15 00:07:07 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -209,7 +209,11 @@ ah_old_zeroize(struct tdb *tdbp)
if (encdebug)
printf("ah_old_zeroize(): freeing memory\n");
#endif /* ENCDEBUG */
- FREE(tdbp->tdb_xdata, M_XDATA);
+ if (tdbp->tdb_xdata)
+ {
+ FREE(tdbp->tdb_xdata, M_XDATA);
+ tdbp->tdb_xdata = NULL;
+ }
return 0;
}
diff --git a/sys/netinet/ip_esp_new.c b/sys/netinet/ip_esp_new.c
index b26e0e9c4da..c442cdda2f7 100644
--- a/sys/netinet/ip_esp_new.c
+++ b/sys/netinet/ip_esp_new.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp_new.c,v 1.10 1997/11/04 09:11:11 provos Exp $ */
+/* $OpenBSD: ip_esp_new.c,v 1.11 1997/11/15 00:07:08 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -441,7 +441,11 @@ esp_new_zeroize(struct tdb *tdbp)
if (encdebug)
printf("esp_new_zeroize(): freeing memory\n");
#endif ENCDEBUG
- FREE(tdbp->tdb_xdata, M_XDATA);
+ if (tdbp->tdb_xdata)
+ {
+ FREE(tdbp->tdb_xdata, M_XDATA);
+ tdbp->tdb_xdata = NULL;
+ }
return 0;
}
diff --git a/sys/netinet/ip_esp_old.c b/sys/netinet/ip_esp_old.c
index 07f89c937bf..5df83f3eba6 100644
--- a/sys/netinet/ip_esp_old.c
+++ b/sys/netinet/ip_esp_old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp_old.c,v 1.10 1997/11/04 09:11:13 provos Exp $ */
+/* $OpenBSD: ip_esp_old.c,v 1.11 1997/11/15 00:07:09 deraadt Exp $ */
/*
* The author of this code is John Ioannidis, ji@tla.org,
@@ -279,7 +279,11 @@ esp_old_zeroize(struct tdb *tdbp)
if (encdebug)
printf("esp_old_zeroize(): freeing memory\n");
#endif /* ENCDEBUG */
- FREE(tdbp->tdb_xdata, M_XDATA);
+ if (tdbp->tdb_xdata)
+ {
+ FREE(tdbp->tdb_xdata, M_XDATA);
+ tdbp->tdb_xdata = NULL;
+ }
return 0;
}