[Samba] connection shutdown tevent_req is not freed

Jeremy Allison jra at samba.org
Thu Sep 15 00:01:53 UTC 2022

On Sun, Sep 04, 2022 at 09:29:52PM -0700, haihua yang via samba wrote:
>The function smbd_server_connection_terminate_done does not free subreq
>which is allocated in smbXsrv_connection_shutdown_send, this can be a
>memory leakage if multi-channel is enabled.
>Following is possible fix,
>diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
>index e8a91238baf..1cd5953f116 100644
>--- a/source3/smbd/smb2_server.c
>+++ b/source3/smbd/smb2_server.c
>@@ -1643,6 +1643,7 @@ static void
>smbd_server_connection_terminate_done(struct tevent_req *subreq)
>        NTSTATUS status;
>        status = smbXsrv_connection_shutdown_recv(subreq);
>+       TALLOC_FREE(subreq);
>        if (!NT_STATUS_IS_OK(status)) {
>                exit_server("smbXsrv_connection_shutdown_recv failed");
>        }

Hi Hihua,

This looks correct. Metze created a bug report:


and I'm pushing an MR to gitlab. If you plan to
contribute more to Samba can you send in the
Samba Developer's Declaration, as described here:


Thanks !


More information about the samba mailing list