sockopt_getmbuf() may fail, handle that possibility

This commit is contained in:
plunky 2008-10-27 20:03:07 +00:00
parent 71c484f48c
commit 8903ff8350

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_output.c,v 1.134 2008/10/12 15:24:10 plunky Exp $ */
/* $NetBSD: ip6_output.c,v 1.135 2008/10/27 20:03:07 plunky Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.134 2008/10/12 15:24:10 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.135 2008/10/27 20:03:07 plunky Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@ -2154,6 +2154,11 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct socket *so,
priv = 1;
m = sockopt_getmbuf(sopt);
if (m == NULL) {
free(opt, M_IP6OPT);
return (ENOBUFS);
}
error = ip6_setpktopts(m, opt, NULL, priv, so->so_proto->pr_protocol);
m_freem(m);
if (error != 0) {