What version of kamailio are you using? The code seems to be safe there.
I also tried to reproduce by having a listen with a non local ip and it didn't crash, it prints the error message and exits:
``` ERROR: <core> [core/udp_server.c:397]: udp_init(): bind(6, 0x10c606504, 16) on 192.168.178.188: Can't assign requested address ```