From e123d63d3f0322683a22e099450e9685a497c625 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 16 Mar 2005 05:27:19 +0000 Subject: [PATCH] plug resource leak Noticed by: Coverity Prevent analysis tool --- sys/netinet/ip_input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index bee0b86eed5c..64e4046ec889 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1574,8 +1574,10 @@ save_rte(m, option, dst) if (ipprintfs) printf("save_rte: olen %d\n", olen); #endif - if (olen > sizeof(opts->ip_srcrt) - (1 + sizeof(dst))) + if (olen > sizeof(opts->ip_srcrt) - (1 + sizeof(dst))) { + m_tag_free((struct m_tag *)opts); return; + } bcopy(option, opts->ip_srcrt.srcopt, olen); opts->ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); opts->ip_srcrt.dst = dst;