43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
From 18913d384edb8c49c69501fd6db5511312614594 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@samba.org>
|
|
Date: Fri, 27 Oct 2023 12:09:53 +0200
|
|
Subject: [PATCH] s3:passdb: Do not leak memory in pdb_tdb
|
|
|
|
==19938==ERROR: LeakSanitizer: detected memory leaks
|
|
|
|
Direct leak of 77 byte(s) in 1 object(s) allocated from:
|
|
#0 0x7f7d482841f8 in strdup (/lib64/libasan.so.8+0x841f8) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
|
|
#1 0x7f7d47204846 (bin/shared/libsamba-util.so.0+0x4c846) (BuildId: 43b084eb9013442ac68eb1fc17649f142cbb0f94)
|
|
#2 0x7f7d40b1d97a in pdb_init_tdbsam ../../source3/passdb/pdb_tdb.c:1361
|
|
#3 0x7f7d4715f266 (bin/shared/libsamba-passdb.so.0+0x76266) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
|
|
#4 0x7f7d4715f57a (bin/shared/libsamba-passdb.so.0+0x7657a) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
|
|
#5 0x7f7d47163700 (bin/shared/libsamba-passdb.so.0+0x7a700) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
|
|
#6 0x55a9177d3853 in main ../../source3/smbd/server.c:1928
|
|
#7 0x7f7d434281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
|
|
|
|
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
|
|
Orabug: 36371906
|
|
Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
|
|
Reviewed-by: Laurence Rochfort <laurence.rochfort@oracle.com>
|
|
---
|
|
source3/passdb/pdb_tdb.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
|
|
index 4c578f8069d..f9ba193df3b 100644
|
|
--- a/source3/passdb/pdb_tdb.c
|
|
+++ b/source3/passdb/pdb_tdb.c
|
|
@@ -1346,6 +1346,9 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
|
|
}
|
|
pfile = tdbfile;
|
|
}
|
|
+
|
|
+ /* Do not leak memory if the init function is called more than once */
|
|
+ SAFE_FREE(tdbsam_filename);
|
|
tdbsam_filename = SMB_STRDUP(pfile);
|
|
if (!tdbsam_filename) {
|
|
return NT_STATUS_NO_MEMORY;
|
|
--
|