The Samba-Bugzilla – Attachment 11629 Details for
Bug 11624
Memory leak after smbc_free_context() on the session while accessing shares on DFS junctions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for fixing the memory leak due to left over cli connection structures after smbc_free_context()
0001-Fix-for-memory-leak-due-to-dangling-cli-connection-s.patch (text/plain), 2.66 KB, created by
hargagan
on 2015-11-30 09:15:54 UTC
(
hide
)
Description:
Proposed patch for fixing the memory leak due to left over cli connection structures after smbc_free_context()
Filename:
MIME Type:
Creator:
hargagan
Created:
2015-11-30 09:15:54 UTC
Size:
2.66 KB
patch
obsolete
>From c665188f58d0f1dbad8f358b3e79b0f41e2bdd39 Mon Sep 17 00:00:00 2001 >From: hargagan <hargagan.sahai@microfocus.com> >Date: Mon, 30 Nov 2015 14:39:55 +0530 >Subject: [PATCH] Fix for memory leak due to dangling cli connection structures > left after smbc_free_context(). > >Signed-off-by: hargagan <hargagan.sahai@microfocus.com> >--- > source3/libsmb/clientgen.c | 20 ++++++++++++++++++++ > source3/libsmb/libsmb_server.c | 6 +++--- > source3/libsmb/proto.h | 1 + > 3 files changed, 24 insertions(+), 3 deletions(-) > >diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c >index 6f28dfa..c85daba 100644 >--- a/source3/libsmb/clientgen.c >+++ b/source3/libsmb/clientgen.c >@@ -278,6 +278,26 @@ static void _cli_shutdown(struct cli_state *cli) > TALLOC_FREE(cli); > } > >+void cli_cleanup(struct cli_state *cli) >+{ >+ struct cli_state *cli_head; >+ if (cli == NULL) { >+ return; >+ } >+ DLIST_HEAD(cli, cli_head); >+ /* >+ * Go to the head and start the cleanup of all in the >+ * connections list. >+ */ >+ struct cli_state *p, *next; >+ >+ for (p = cli_head; p; p = next) { >+ next = p->next; >+ DLIST_REMOVE(cli_head, p); >+ _cli_shutdown(p); >+ } >+} >+ > void cli_shutdown(struct cli_state *cli) > { > struct cli_state *cli_head; >diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c >index 07d51ea..a4b8939 100644 >--- a/source3/libsmb/libsmb_server.c >+++ b/source3/libsmb/libsmb_server.c >@@ -89,7 +89,7 @@ SMBC_remove_unused_server(SMBCCTX * context, > for (file = context->internal->files; file; file = file->next) { > if (file->srv == srv) { > /* Still used */ >- DEBUG(3, ("smbc_remove_usused_server: " >+ DEBUG(3, ("smbc_remove_unused_server: " > "%p still used by %p.\n", > srv, file)); > return 1; >@@ -98,10 +98,10 @@ SMBC_remove_unused_server(SMBCCTX * context, > > DLIST_REMOVE(context->internal->servers, srv); > >- cli_shutdown(srv->cli); >+ cli_cleanup(srv->cli); > srv->cli = NULL; > >- DEBUG(3, ("smbc_remove_usused_server: %p removed.\n", srv)); >+ DEBUG(3, ("smbc_remove_unused_server: %p removed.\n", srv)); > > smbc_getFunctionRemoveCachedServer(context)(context, srv); > >diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h >index 5ebcf5f..a48551f 100644 >--- a/source3/libsmb/proto.h >+++ b/source3/libsmb/proto.h >@@ -170,6 +170,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, > int flags); > void cli_nt_pipes_close(struct cli_state *cli); > void cli_shutdown(struct cli_state *cli); >+void cli_cleanup(struct cli_state *cli); > const char *cli_state_remote_realm(struct cli_state *cli); > uint16_t cli_state_get_vc_num(struct cli_state *cli); > uint16_t cli_setpid(struct cli_state *cli, uint16_t pid); >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11624
:
11629
|
11730
|
11738