raw.c: Avoid NULL pointer dereference

This commit is contained in:
Dirk Ziegelmeier 2016-03-02 23:44:51 +01:00
parent f9ce31f98b
commit e89b48d23f

View File

@ -434,8 +434,10 @@ raw_new_ip6(u8_t proto)
struct raw_pcb *pcb;
pcb = raw_new(proto);
#if LWIP_IPV4
IP_SET_TYPE_VAL(pcb->local_ip, IPADDR_TYPE_V6);
IP_SET_TYPE_VAL(pcb->remote_ip, IPADDR_TYPE_V6);
if(pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, IPADDR_TYPE_V6);
IP_SET_TYPE_VAL(pcb->remote_ip, IPADDR_TYPE_V6);
}
#endif /* LWIP_IPV4 */
return pcb;
}