[PATCH] Fix new Coverity IDs

Volker Lendecke vl at samba.org
Tue Jan 10 20:03:08 UTC 2017


Hi!

Review appreciated!

Thanks, Volker
-------------- next part --------------
>From 0d33fbf115ac347f8f875d0259107eaa64e3294b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:24:22 +0000
Subject: [PATCH 1/6] winbind: Fix CID 1398533 Resource leak

Not really a leak due to talloc, but this way it's clear

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

diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c
index 4b742c4..0d0e4ca 100644
--- a/source3/winbindd/winbindd_msrpc.c
+++ b/source3/winbindd/winbindd_msrpc.c
@@ -90,6 +90,7 @@ static NTSTATUS msrpc_query_user_list(struct winbindd_domain *domain,
 	}
 
 done:
+	TALLOC_FREE(rids);
 	TALLOC_FREE(tmp_ctx);
 	return status;
 }
-- 
2.1.4


>From 590a3fcb268798b0895f51a052bbf512b6d6ff79 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:26:13 +0000
Subject: [PATCH 2/6] winbind: Fix CID 1398533 Resource leak

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

diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index bb8af45..fcc6366 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -77,6 +77,7 @@ NTSTATUS rpc_query_user_list(TALLOC_CTX *mem_ctx,
 		}
 		if (!NT_STATUS_IS_OK(result)) {
 			if (!NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) {
+				TALLOC_FREE(rids);
 				return result;
 			}
 		}
-- 
2.1.4


>From 7ed931f595902fe22f089a598dded484e91dc996 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:24:22 +0000
Subject: [PATCH 3/6] winbind: Fix CID 1398531 Resource leak

Not really a leak due to talloc, but this way it's clear

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

diff --git a/source3/winbindd/winbindd_samr.c b/source3/winbindd/winbindd_samr.c
index dd67496..224f105 100644
--- a/source3/winbindd/winbindd_samr.c
+++ b/source3/winbindd/winbindd_samr.c
@@ -208,6 +208,7 @@ done:
 		dcerpc_samr_Close(b, mem_ctx, &dom_pol, &result);
 	}
 
+	TALLOC_FREE(rids);
 	TALLOC_FREE(tmp_ctx);
 	return status;
 }
-- 
2.1.4


>From a3dda77c981ccbc6204ed56274bced0009f1b1f2 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:28:41 +0000
Subject: [PATCH 4/6] winbind: Fix CID 1398530 Resource leak

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

diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 8357968..b14f21e 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -356,8 +356,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
 		}
 
 		if (!ads_pull_sid(ads, msg, "objectSid", &user_sid)) {
-			DBG_INFO("No sid for %s !?\n",
-				 ads_get_dn(ads, talloc_tos(), msg));
+			char *dn = ads_get_dn(ads, talloc_tos(), msg);
+			DBG_INFO("No sid for %s !?\n", dn);
+			TALLOC_FREE(dn);
 			continue;
 		}
 
-- 
2.1.4


>From 830356bb8c75e0052d17afd2264eb96bdbb701c7 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:29:38 +0000
Subject: [PATCH 5/6] winbind: Fix CID 1398530 Resource leak

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

diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index d92c050..4431cb5 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -1457,6 +1457,7 @@ do_fetch_cache:
 
 	rids = talloc_array(mem_ctx, uint32_t, num_rids);
 	if (rids == NULL) {
+		centry_free(centry);
 		return NT_STATUS_NO_MEMORY;
 	}
 
-- 
2.1.4


>From ce65b259cb8088a3665b062834ee969af5fbd895 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 10 Jan 2017 13:30:49 +0000
Subject: [PATCH 6/6] winbind: Fix CID 1398534 Dereference before null check

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

diff --git a/source3/winbindd/winbindd_samr.c b/source3/winbindd/winbindd_samr.c
index 224f105..4f3730b 100644
--- a/source3/winbindd/winbindd_samr.c
+++ b/source3/winbindd/winbindd_samr.c
@@ -199,9 +199,7 @@ static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
 		goto done;
 	}
 
-	if (prids) {
-		*prids = talloc_move(mem_ctx, &rids);
-	}
+	*prids = talloc_move(mem_ctx, &rids);
 
 done:
 	if (b && is_valid_policy_hnd(&dom_pol)) {
-- 
2.1.4



More information about the samba-technical mailing list