/********************************************************************
********************************************************************/
-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);
}
/********************************************************************
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 );
/* 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;
}