summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>1999-05-23 12:37:46 +0000
committerHakan Olsson <ho@cvs.openbsd.org>1999-05-23 12:37:46 +0000
commitbd3846209995d875b04576fcb40766bbc82c16c6 (patch)
treee23748074336e97c6d1dfa7e01b78563ede9c539 /sys/net
parent7848cea529c2f86ba40f2d76a9e01f01f3c6af8f (diff)
Avoid bzero + free after failed malloc(). From niklas@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pfkeyv2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index a958c59af9a..cc99644f8f7 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -548,8 +548,10 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *socket,
}
ret:
- bzero(buffer, j + sizeof(struct sadb_msg));
- free(buffer, M_TEMP);
+ if (buffer != NULL) {
+ bzero(buffer, j + sizeof(struct sadb_msg));
+ free(buffer, M_TEMP);
+ }
return rval;
}