[PATCHSET] Fix some memory leaks
Uri Simchoni
uri at samba.org
Thu Jun 23 08:07:32 UTC 2016
On 06/22/2016 10:08 AM, Andreas Schneider wrote:
> Hi,
>
> as I'm currently packaging Samba 4.4.4 for RHEL our tools discovered some
> memory leaks.
>
> Find attached a patch which fixes memory leaks in smbget and the wbclient
> test.
>
>
> Review appreciated.
>
>
> Thanks,
>
>
> -- andreas
>
I have the following attached fixups (if they are good - should be
squashed into the relevant patches). Otherwise RB+ me
-------------- next part --------------
From 28345d7123562d837f6463c7b7869a53ab58e8cc Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Thu, 23 Jun 2016 10:15:16 +0300
Subject: [PATCH 1/3] small fixup to the test_wbc_pingdc2 patch
---
nsswitch/libwbclient/tests/wbclient.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 67c951c..6627374 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -128,6 +128,8 @@ static bool test_wbc_pingdc2(struct torture_context *tctx)
wbcPingDc2(NULL, NULL, &name),
"%s",
"wbcPingDc2 failed");
+ wbcFreeMemory(name);
+ name = NULL;
torture_assert_wbc_ok_goto_fail(tctx,
wbcInterfaceDetails(&details),
@@ -148,6 +150,8 @@ static bool test_wbc_pingdc2(struct torture_context *tctx)
wbcPingDc2(details->netbios_domain, NULL, &name),
"wbcPingDc2(%s) failed",
details->netbios_domain);
+ wbcFreeMemory(name);
+ name = NULL;
torture_assert_wbc_ok_goto_fail(tctx,
wbcPingDc2("BUILTIN", NULL, &name),
--
2.5.5
From 29c05e71ae897f8352fcd0feb543ce71c6d2497b Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Thu, 23 Jun 2016 10:30:32 +0300
Subject: [PATCH 2/3] small fixup to test_wbc_users
---
nsswitch/libwbclient/tests/wbclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 6627374..583be69 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -300,7 +300,7 @@ static bool test_wbc_users(struct torture_context *tctx)
domain_name = talloc_strdup(tctx, details->netbios_domain);
torture_assert_goto(tctx,
- domain_name == NULL,
+ domain_name != NULL,
ret,
fail,
"Failed to allocate domain_name");
--
2.5.5
From ebfe3c9ada1fa06b38a8293e48d13e71c0f31999 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Thu, 23 Jun 2016 10:39:22 +0300
Subject: [PATCH 3/3] small fixup to test_wbc_groups
---
nsswitch/libwbclient/tests/wbclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 583be69..0412bed 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -403,7 +403,7 @@ static bool test_wbc_groups(struct torture_context *tctx)
domain_name = talloc_strdup(tctx, details->netbios_domain);
torture_assert_goto(tctx,
- domain_name == NULL,
+ domain_name != NULL,
ret,
fail,
"Failed to allocate domain_name");
--
2.5.5
More information about the samba-technical
mailing list