diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 1999-05-23 12:37:46 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 1999-05-23 12:37:46 +0000 |
commit | bd3846209995d875b04576fcb40766bbc82c16c6 (patch) | |
tree | e23748074336e97c6d1dfa7e01b78563ede9c539 /sys/net | |
parent | 7848cea529c2f86ba40f2d76a9e01f01f3c6af8f (diff) |
Avoid bzero + free after failed malloc(). From niklas@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pfkeyv2.c | 6 |
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; } |