Add protection code to free memory in case of processing an address which

is neither IPv4 or IPv6.

Reported by:	Coverity
CID:		749311
MFC after:	1 week
This commit is contained in:
Michael Tuexen 2015-01-18 20:53:20 +00:00
parent 86ee58d992
commit 3ff78fbbd9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277347

View File

@ -3346,6 +3346,11 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb,
TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
break;
#endif
default:
SCTPDBG(SCTP_DEBUG_ASCONF1,
"sctp_asconf_send_nat_state_update: unknown address family\n");
SCTP_FREE(aa, SCTP_M_ASC_ADDR);
return;
}
SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa),
SCTP_M_ASC_ADDR);
@ -3379,6 +3384,11 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb,
TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
break;
#endif
default:
SCTPDBG(SCTP_DEBUG_ASCONF1,
"sctp_asconf_send_nat_state_update: unknown address family\n");
SCTP_FREE(aa, SCTP_M_ASC_ADDR);
return;
}
/* Now we must hunt the addresses and add all global addresses */
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {