summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}