summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-10 07:30:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-10 07:30:05 +0000
commit1e7e55588485e0887abb14a6d5f5d5c5d93698d6 (patch)
tree103ecca9ad0b6dc6ed4c81a8b5b1119cc7ec709b
parentf98bdd8cc6185284d5fae76daae5170c913e2d1a (diff)
do not lose an mbuf, ensure MCLGET did not give a chain
-rw-r--r--sys/nfs/krpc_subr.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index 53c17e84445..d449cdc0fa4 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: krpc_subr.c,v 1.4 1996/04/21 22:30:16 deraadt Exp $ */
-/* $NetBSD: krpc_subr.c,v 1.12 1996/02/18 11:53:36 fvdl Exp $ */
+/* $OpenBSD: krpc_subr.c,v 1.5 1996/06/10 07:30:04 deraadt Exp $ */
+/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@@ -472,13 +472,16 @@ xdr_string_encode(str, len)
dlen = (len + 3) & ~3;
mlen = dlen + 4;
+ if (mlen > MCLBYTES) /* If too big, we just can't do it. */
+ return (NULL);
+
m = m_get(M_WAIT, MT_DATA);
if (mlen > MLEN) {
- if (mlen > MCLBYTES)
- return(NULL);
MCLGET(m, M_WAIT);
- if (m == NULL)
- return NULL;
+ if ((m->m_flags & M_EXT) == 0) {
+ (void) m_free(m); /* There can be only one. */
+ return (NULL);
+ }
}
xs = mtod(m, struct xdr_string *);
m->m_len = mlen;