[PATCH] cleanup patches

Volker Lendecke Volker.Lendecke at SerNet.DE
Sun Jan 11 04:38:47 MST 2015


Hi!

Review&push would be appreciated!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 90d3e039b675d88c2a5af7f0bc8c94c19b3422d0 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 9 Jan 2015 15:38:19 +0100
Subject: [PATCH 1/3] smbd: Make talloc_report of smb_filename more readable

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/filename_util.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index 3ebf311..316360b 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -199,14 +199,20 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
 	if (in->base_name != NULL) {
 		out->base_name = talloc_memdup(
 				out, in->base_name, base_len);
+		talloc_set_name_const(out->base_name,
+				      out->base_name);
 	}
 	if (in->stream_name != NULL) {
 		out->stream_name = talloc_memdup(
 				out, in->stream_name, stream_len);
+		talloc_set_name_const(out->stream_name,
+				      out->stream_name);
 	}
 	if (in->original_lcomp != NULL) {
 		out->original_lcomp = talloc_memdup(
 				out, in->original_lcomp, lcomp_len);
+		talloc_set_name_const(out->original_lcomp,
+				      out->original_lcomp);
 	}
 	out->st = in->st;
 	return out;
-- 
1.9.1


From ace56e8ead43ec5c6097cd380a26c40bbc6b359c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 9 Jan 2015 15:45:41 +0100
Subject: [PATCH 2/3] smbd: Fix an uninitialized variable read

If dbwrap_fetch_locked failed, we did a TALLOC_FREE(value). Fix this with a
talloc hierarchy.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/locking/leases_db.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/source3/locking/leases_db.c b/source3/locking/leases_db.c
index 0700ba9..eceecd8 100644
--- a/source3/locking/leases_db.c
+++ b/source3/locking/leases_db.c
@@ -243,7 +243,7 @@ NTSTATUS leases_db_del(const struct GUID *client_guid,
 		goto out;
 	}
 
-	value = talloc(talloc_tos(), struct leases_db_value);
+	value = talloc(rec, struct leases_db_value);
 	if (value == NULL) {
 		status = NT_STATUS_NO_MEMORY;
 		goto out;
@@ -308,7 +308,6 @@ NTSTATUS leases_db_del(const struct GUID *client_guid,
 
   out:
 
-	TALLOC_FREE(value);
 	TALLOC_FREE(rec);
 	return status;
 }
-- 
1.9.1


From 13811170f9b131f9487f385adaf61feca446b7fa Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 9 Jan 2015 15:47:18 +0100
Subject: [PATCH 3/3] smbd: Fix a small leak on talloc_tos()

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/locking/leases_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/locking/leases_db.c b/source3/locking/leases_db.c
index eceecd8..2ee6a26 100644
--- a/source3/locking/leases_db.c
+++ b/source3/locking/leases_db.c
@@ -283,7 +283,7 @@ NTSTATUS leases_db_del(const struct GUID *client_guid,
 	} else {
 		DEBUG(10, ("%s: updating record\n", __func__));
 		ndr_err = ndr_push_struct_blob(
-			&blob, talloc_tos(), value,
+			&blob, rec, value,
 			(ndr_push_flags_fn_t)ndr_push_leases_db_value);
 		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 			DEBUG(10, ("%s: ndr_push_struct_blob_failed: %s\n",
-- 
1.9.1



More information about the samba-technical mailing list