From 31f1c2172ca8a8a32c69a06a9388daecfc9c25ce Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Thu, 4 Apr 2002 06:55:32 +0000 Subject: 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) --- source3/include/rpc_misc.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source3/include') diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index 7398b8ac57..e47853c2a2 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -323,6 +323,18 @@ typedef struct lsa_policy_info uint16 data3; uint16 data4; uint8 data5[8]; + +#ifdef __INSURE__ + + /* To prevent the leakage of policy handles mallocate a bit of + memory when a policy handle is created and free it when the + handle is closed. This should cause Insure to flag an error + when policy handles are overwritten or fall out of scope without + being freed. */ + + char *marker; +#endif + } POLICY_HND; /* -- cgit