bind_address has been moved inside the config structure. Fixed up a
problem where "data" was being freed even if it had not been allocated (because of an error condition.)
This commit is contained in:
parent
335d787018
commit
d7c3f23610
@ -1,4 +1,4 @@
|
|||||||
/* $Id: sock.c,v 1.32 2002-04-22 19:35:24 rjkaes Exp $
|
/* $Id: sock.c,v 1.33 2002-04-24 16:48:34 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Sockets are created and destroyed here. When a new connection comes in from
|
* Sockets are created and destroyed here. When a new connection comes in from
|
||||||
* a client, we need to copy the socket and the create a second socket to the
|
* a client, we need to copy the socket and the create a second socket to the
|
||||||
@ -111,15 +111,15 @@ opensock(char *ip_addr, uint16_t port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Bind to our listening address*/
|
/* Bind to our listening address*/
|
||||||
if (bind_address) {
|
if (config.bind_address) {
|
||||||
memset(&bind_addr, 0, sizeof(bind_addr));
|
memset(&bind_addr, 0, sizeof(bind_addr));
|
||||||
bind_addr.sin_family = AF_INET;
|
bind_addr.sin_family = AF_INET;
|
||||||
bind_addr.sin_addr.s_addr = inet_addr(bind_address);
|
bind_addr.sin_addr.s_addr = inet_addr(config.bind_address);
|
||||||
|
|
||||||
ret = bind(sock_fd, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
|
ret = bind(sock_fd, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log_message(LOG_ERR, "Could not bind local address \"%\" because of %s",
|
log_message(LOG_ERR, "Could not bind local address \"%\" because of %s",
|
||||||
bind_address,
|
config.bind_address,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -483,6 +483,7 @@ readline(int fd, char **whole_buffer)
|
|||||||
CLEANUP:
|
CLEANUP:
|
||||||
do {
|
do {
|
||||||
line_ptr = first_line->next;
|
line_ptr = first_line->next;
|
||||||
|
if (first_line->data)
|
||||||
safefree(first_line->data);
|
safefree(first_line->data);
|
||||||
safefree(first_line);
|
safefree(first_line);
|
||||||
first_line = line_ptr;
|
first_line = line_ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user