summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-01-07 17:56:08 +0100
committerVolker Lendecke <vl@samba.org>2009-01-08 22:29:53 +0100
commitbaa5c5eeb0c86ac9ae9edfd15da2621d2959938a (patch)
tree85df9cb593847e8b2a7f4d6497abead550a5c27d /source3
parent52b6756c4e5c0ab7cd74e23de36ac5df217d103b (diff)
downloadsamba-baa5c5eeb0c86ac9ae9edfd15da2621d2959938a.tar.gz
samba-baa5c5eeb0c86ac9ae9edfd15da2621d2959938a.tar.bz2
samba-baa5c5eeb0c86ac9ae9edfd15da2621d2959938a.zip
Make use of a talloc_destructor for free_eventlog_info()
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_eventlog_nt.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c
index e5be325a16..7b7f381d91 100644
--- a/source3/rpc_server/srv_eventlog_nt.c
+++ b/source3/rpc_server/srv_eventlog_nt.c
@@ -37,14 +37,17 @@ typedef struct {
/********************************************************************
********************************************************************/
-static void free_eventlog_info( void *ptr )
+static int eventlog_info_destructor(EVENTLOG_INFO *elog)
{
- EVENTLOG_INFO *elog = (EVENTLOG_INFO *)ptr;
-
- if ( elog->etdb )
- elog_close_tdb( elog->etdb, False );
+ if (elog->etdb) {
+ elog_close_tdb(elog->etdb, false);
+ }
+ return 0;
+}
- TALLOC_FREE( elog );
+static void free_eventlog_info( void *ptr )
+{
+ TALLOC_FREE(ptr);
}
/********************************************************************
@@ -186,6 +189,7 @@ static NTSTATUS elog_open( pipes_struct * p, const char *logname, POLICY_HND *hn
if ( !(elog = TALLOC_ZERO_P( NULL, EVENTLOG_INFO )) )
return NT_STATUS_NO_MEMORY;
+ talloc_set_destructor(elog, eventlog_info_destructor);
elog->logname = talloc_strdup( elog, logname );
@@ -228,7 +232,6 @@ static NTSTATUS elog_open( pipes_struct * p, const char *logname, POLICY_HND *hn
/* now do the access check. Close the tdb if we fail here */
if ( !elog_check_access( elog, p->server_info->ptok ) ) {
- elog_close_tdb( elog->etdb, False );
TALLOC_FREE( elog );
return NT_STATUS_ACCESS_DENIED;
}