aboutsummaryrefslogtreecommitdiff
path: root/sys/netkey
diff options
context:
space:
mode:
authorJonathan Lemon <jlemon@FreeBSD.org>2000-06-10 17:55:57 +0000
committerJonathan Lemon <jlemon@FreeBSD.org>2000-06-10 17:55:57 +0000
commit6776c7cba92c91bbe5a49de3052461002f496513 (patch)
tree112cc1aecc9c0a17443edbf9500180f1a37df8c3 /sys/netkey
parent068b0778a31a2d579f8a554bc5a5f82a992874a0 (diff)
downloadsrc-6776c7cba92c91bbe5a49de3052461002f496513.tar.gz
src-6776c7cba92c91bbe5a49de3052461002f496513.zip
Check for MGET* returning NULL and return ENOBUFS in this case.
Submitted by: Bosko Milekic <bmilekic@technokratis.com>
Notes
Notes: svn path=/head/; revision=61505
Diffstat (limited to 'sys/netkey')
-rw-r--r--sys/netkey/keysock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c
index b3c8652ec786..f26e8a5dc85f 100644
--- a/sys/netkey/keysock.c
+++ b/sys/netkey/keysock.c
@@ -419,13 +419,19 @@ key_sendup(so, msg, len, target)
while (tlen > 0) {
if (tlen == len) {
MGETHDR(n, M_DONTWAIT, MT_DATA);
+ if (n == NULL) {
+ m_freem(m);
+ return ENOBUFS;
+ }
n->m_len = MHLEN;
} else {
MGET(n, M_DONTWAIT, MT_DATA);
+ if (n == NULL) {
+ m_freem(m);
+ return ENOBUFS;
+ }
n->m_len = MLEN;
}
- if (!n)
- return ENOBUFS;
if (tlen > MCLBYTES) { /*XXX better threshold? */
MCLGET(n, M_DONTWAIT);
if ((n->m_flags & M_EXT) == 0) {