mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-12 13:13:21 +00:00
udp: Fix possible NULL pointer dereference, update comments
This commit is contained in:
parent
babb247e2a
commit
f3132c5290
@ -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
|
||||
IP_SET_TYPE_VAL(pcb->local_ip, type);
|
||||
IP_SET_TYPE_VAL(pcb->remote_ip, type);
|
||||
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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user