Skip to content

Commit

Permalink
Free listeners as the sockets are freed without using steal
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed May 14, 2024
1 parent 8a4c3cd commit aa41f58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 1 addition & 5 deletions src/lib/io/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,7 @@ static int _network_socket_free(fr_network_socket_t *s)
}

talloc_free(s->waiting);
talloc_free(s->listen);

return 0;
}
Expand Down Expand Up @@ -1335,7 +1336,6 @@ static int fr_network_listen_add_self(fr_network_t *nr, fr_listen_t *li)

s = talloc_zero(nr, fr_network_socket_t);
fr_assert(s != NULL);
talloc_steal(s, li);

s->nr = nr;
s->listen = li;
Expand Down Expand Up @@ -1428,12 +1428,8 @@ static void fr_network_directory_callback(void *ctx, void const *data, size_t da

if (fr_cond_assert(data_size == sizeof(li))) return;

memcpy(&li, data, sizeof(li));

s = talloc_zero(nr, fr_network_socket_t);
fr_assert(s != NULL);
talloc_steal(s, li);

s->nr = nr;
s->listen = li;
s->number = nr->num_sockets++;
Expand Down
8 changes: 0 additions & 8 deletions src/listen/detail/proto_detail_work.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,6 @@ static int mod_close_internal(proto_detail_work_thread_t *thread)
close(thread->fd);
thread->fd = -1;

/*
* If we've been spawned from proto_detail_file, clean
* ourselves up, including our listener.
*/
if (thread->listen) {
talloc_free(thread->listen);
}

if (inst->parent->exit_when_done) {
INFO("Done reading detail files, process will now exit");

Expand Down

0 comments on commit aa41f58

Please sign in to comment.