summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}