summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c2
-rw-r--r--source3/smbd/session.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index cd2750d759..05b1e812b2 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -4213,7 +4213,7 @@ static BOOL api_RNetSessionEnum(connection_struct *conn, uint16 vuid,
return False;
}
- num_sessions = list_sessions(&session_list);
+ num_sessions = list_sessions(tmp_talloc_ctx(), &session_list);
if (mdrcnt > 0) {
*rdata = SMB_REALLOC_LIMIT(*rdata,mdrcnt);
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 05b1026f41..30ade8aedf 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -218,6 +218,7 @@ BOOL session_traverse(int (*fn)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *),
********************************************************************/
struct session_list {
+ TALLOC_CTX *mem_ctx;
int count;
struct sessionid *sessions;
};
@@ -230,7 +231,9 @@ static int gather_sessioninfo(TDB_CONTEXT *stdb, TDB_DATA kbuf, TDB_DATA dbuf, v
i = sesslist->count;
- sesslist->sessions = SMB_REALLOC_ARRAY(sesslist->sessions, struct sessionid, i+1);
+ sesslist->sessions = TALLOC_REALLOC_ARRAY(
+ sesslist->mem_ctx, sesslist->sessions, struct sessionid, i+1);
+
if (!sesslist->sessions) {
sesslist->count = 0;
return -1;
@@ -248,10 +251,11 @@ static int gather_sessioninfo(TDB_CONTEXT *stdb, TDB_DATA kbuf, TDB_DATA dbuf, v
/********************************************************************
********************************************************************/
-int list_sessions(struct sessionid **session_list)
+int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list)
{
struct session_list sesslist;
+ sesslist.mem_ctx = mem_ctx;
sesslist.count = 0;
sesslist.sessions = NULL;