diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index a898cf2d68bb..88f3b4d34f6f 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1560,7 +1560,7 @@ ip6_ctloutput(so, sopt) error = (*ip6_fw_ctl_ptr)(optname, mp); if (error == 0) error = soopt_mcopyout(sopt, m); /* XXX */ - if (m) + if (error == 0 && m) m_freem(m); } break;