summaryrefslogtreecommitdiff
path: root/source3/libsmb/cli_samr.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-04 06:55:32 +0000
committerTim Potter <tpot@samba.org>2002-04-04 06:55:32 +0000
commit31f1c2172ca8a8a32c69a06a9388daecfc9c25ce (patch)
treedc9cb1fd93b33c1e895a8169adcba2efcb5d9e33 /source3/libsmb/cli_samr.c
parentf98b2faf9918395681fd912f67026d1e68f4fcab (diff)
downloadsamba-31f1c2172ca8a8a32c69a06a9388daecfc9c25ce.tar.gz
samba-31f1c2172ca8a8a32c69a06a9388daecfc9c25ce.tar.bz2
samba-31f1c2172ca8a8a32c69a06a9388daecfc9c25ce.zip
If compiling with Insure, mallocate a byte of memory and attach it to the
POLICY_HND structure when passing new handles back from the appropriate cli_* functions. When closing the policy handle free the memory. Insure (and indeed other memory checkers) should detect handles that have not been closed properly as memory leaks. Unfortunately this can only be done when the program terminates (set insure++.summarize leaks in your .psrc file) rather than when the policy handle falls out of scope. Looks like Jeremy has squished all the policy handle leaks at the moment but more are bound to crop up later. (This used to be commit 6dc80d625752f0a3ce6fd7b2278095529c6ec29f)
Diffstat (limited to 'source3/libsmb/cli_samr.c')
-rw-r--r--source3/libsmb/cli_samr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/libsmb/cli_samr.c b/source3/libsmb/cli_samr.c
index 53203e3d79..85a7375f99 100644
--- a/source3/libsmb/cli_samr.c
+++ b/source3/libsmb/cli_samr.c
@@ -69,6 +69,9 @@ NTSTATUS cli_samr_connect(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(result = r.status)) {
*connect_pol = r.connect_pol;
+#ifdef __INSURE__
+ connect_pol->marker = malloc(1);
+#endif
}
done:
@@ -114,6 +117,9 @@ NTSTATUS cli_samr_close(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Return output parameters */
if (NT_STATUS_IS_OK(result = r.status)) {
+#ifdef __INSURE__
+ SAFE_FREE(connect_pol->marker);
+#endif
*connect_pol = r.pol;
}
@@ -162,6 +168,9 @@ NTSTATUS cli_samr_open_domain(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(result = r.status)) {
*domain_pol = r.domain_pol;
+#ifdef __INSURE__
+ domain_pol->marker = malloc(1);
+#endif
}
done:
@@ -209,6 +218,9 @@ NTSTATUS cli_samr_open_user(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(result = r.status)) {
*user_pol = r.user_pol;
+#ifdef __INSURE__
+ user_pol->marker = malloc(1);
+#endif
}
done:
@@ -256,6 +268,9 @@ NTSTATUS cli_samr_open_group(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(result = r.status)) {
*group_pol = r.pol;
+#ifdef __INSURE__
+ group_pol->marker = malloc(1);
+#endif
}
done:
@@ -759,6 +774,9 @@ NTSTATUS cli_samr_open_alias(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(result = r.status)) {
*alias_pol = r.pol;
+#ifdef __INSURE__
+ alias_pol->marker = malloc(1);
+#endif
}
done: