mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 06:03:12 +00:00
fixed file descriptor leak when trying to bind to an interface.
This commit is contained in:
parent
b281edec05
commit
cf500085b4
@ -211,6 +211,8 @@ int overlay_interface_init_socket(int interface,struct sockaddr_in src_addr,stru
|
|||||||
if (debug&DEBUG_PACKETRX) fprintf(stderr,"src_addr=%08x\n",(unsigned int)broadcast.sin_addr.s_addr);
|
if (debug&DEBUG_PACKETRX) fprintf(stderr,"src_addr=%08x\n",(unsigned int)broadcast.sin_addr.s_addr);
|
||||||
if(bind(I(fd),(struct sockaddr *)&broadcast,sizeof(broadcast))) {
|
if(bind(I(fd),(struct sockaddr *)&broadcast,sizeof(broadcast))) {
|
||||||
perror("bind()");
|
perror("bind()");
|
||||||
|
close(I(fd));
|
||||||
|
I(fd)=-1;
|
||||||
return WHY("MP HLR server could not bind to requested UDP port (bind() failed)");
|
return WHY("MP HLR server could not bind to requested UDP port (bind() failed)");
|
||||||
}
|
}
|
||||||
if (debug&(DEBUG_PACKETRX|DEBUG_IO)) fprintf(stderr,"Bound to port 0x%04x\n",broadcast.sin_port);
|
if (debug&(DEBUG_PACKETRX|DEBUG_IO)) fprintf(stderr,"Bound to port 0x%04x\n",broadcast.sin_port);
|
||||||
|
Loading…
Reference in New Issue
Block a user