udp: Fix possible NULL pointer dereference, update comments

This commit is contained in:
Dirk Ziegelmeier 2016-03-02 23:10:43 +01:00
parent babb247e2a
commit f3132c5290

View File

@ -1121,8 +1121,9 @@ udp_new(void)
}
/**
* Create a UDP PCB for specific IP type. See IPADDR_TYPE_XX definitions.
* Create a UDP PCB for specific IP type.
*
* @param IP address type, see IPADDR_TYPE_XX definitions.
* @return The UDP PCB which was created. NULL if the PCB data structure
* could not be allocated.
*
@ -1134,8 +1135,10 @@ udp_new_ip_type(u8_t type)
struct udp_pcb *pcb;
pcb = udp_new();
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}
#else
LWIP_UNUSED_ARG(type);
#endif /* LWIP_IPV4 && LWIP_IPV6 */