Writer *writer;
int r;
+ /* This takes ownership of name, but only on success. */
+
assert(fd >= 0);
assert(source);
RemoteSource *source;
int r;
+ /* This takes ownership of name, even on failure, if own_name is true. */
+
assert(s);
assert(fd >= 0);
assert(name);
if (r < 0) {
log_error("Failed to create source for fd:%d (%s): %s",
fd, name, strerror(-r));
+ free(name);
return r;
}
log_info("Received a connection socket (fd:%d) from %s", fd, hostname);
r = add_source(s, fd, hostname, true);
- if (r < 0)
- free(hostname);
} else {
log_error("Unknown socket passed on fd:%d", fd);
uint32_t revents,
void *userdata) {
RemoteServer *s = userdata;
- int fd2, r;
+ int fd2;
SocketAddress addr = {
.size = sizeof(union sockaddr_union),
.type = SOCK_STREAM,
if (fd2 < 0)
return fd2;
- r = add_source(s, fd2, hostname, true);
- if (r < 0)
- free(hostname);
- return r;
+ return add_source(s, fd2, hostname, true);
}
/**********************************************************************