[PR PATCH] [Updated] Bso 13435

Andrew Bartlett abartlet at samba.org
Wed May 16 18:46:00 UTC 2018


On Wed, 2018-05-16 at 17:33 +0000, Github bot account via samba-
technical wrote:
> There is an updated pull request by noelpower against master on the Samba Samba Github repository
> 
> https://github.com/noelpower/samba bso-13435
> https://github.com/samba-team/samba/pull/187
> 
> Bso 13435
> Fix for https://bugzilla.samba.org/show_bug.cgi?id=13435
> 
> A patch file from https://github.com/samba-team/samba/pull/187.patch is attached

Please check and include this fixup patch for the memory handling.

Otherwise:

Reviewed-by: Andrew Bartlett <abartlet at samba.org> 

Thanks!

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
-------------- next part --------------
From c65631477fa5d6b42b77b5d093733b544c251cb5 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Thu, 17 May 2018 06:37:28 +1200
Subject: [PATCH] FIXUP: Improve memory handling on py_net_change_password

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 source4/libnet/py_net.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 6aff373b359..65060d53091 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -195,22 +195,27 @@ static PyObject *py_net_change_password(py_net_Object *self, PyObject *args, PyO
 
 	mem_ctx = talloc_new(ev);
 	if (mem_ctx == NULL) {
+		PyMem_Free(discard_const_p(char, newpass));
+		PyMem_Free(discard_const_p(char, oldpass));
 		PyErr_NoMemory();
 		return NULL;
 	}
 
 	status = libnet_ChangePassword(self->libnet_ctx, mem_ctx, &r);
+
+	PyMem_Free(discard_const_p(char, newpass));
+	PyMem_Free(discard_const_p(char, oldpass));
+
 	if (NT_STATUS_IS_ERR(status)) {
 		PyErr_SetNTSTATUS_and_string(status,
 					     r.generic.out.error_string
 					     ? r.generic.out.error_string
 					     : nt_errstr(status));
+		talloc_free(mem_ctx);
 		return NULL;
 	}
 
 	talloc_free(mem_ctx);
-	PyMem_Free(discard_const_p(char,newpass));
-	PyMem_Free(discard_const_p(char,oldpass));
 	Py_RETURN_NONE;
 }
 
-- 
2.14.3



More information about the samba-technical mailing list