1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1999-2021 The OpenLDAP Foundation.
5  * Portions Copyright 1999 John C. Quillan.
6  * Portions Copyright 2002 myinternet Limited.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 
18 #include "perl_back.h"
19 #include "../slap-config.h"
20 /**********************************************************
21  *
22  * Close
23  *
24  **********************************************************/
25 
26 int
perl_back_close(BackendInfo * bd)27 perl_back_close(
28 	BackendInfo *bd
29 )
30 {
31 	perl_destruct(PERL_INTERPRETER);
32 	perl_free(PERL_INTERPRETER);
33 	PERL_INTERPRETER = NULL;
34 #ifdef PERL_SYS_TERM
35 	PERL_SYS_TERM();
36 #endif
37 
38 	ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex );
39 
40 	return 0;
41 }
42 
43 int
perl_back_db_destroy(BackendDB * be,ConfigReply * cr)44 perl_back_db_destroy(
45 	BackendDB *be,
46 	ConfigReply *cr
47 )
48 {
49 	PerlBackend *pb = be->be_private;
50 
51 	ch_free( pb->pb_module_name );
52 	ber_bvarray_free( pb->pb_module_path );
53 	ber_bvarray_free( pb->pb_module_config );
54 
55 	free( be->be_private );
56 	be->be_private = NULL;
57 
58 	return 0;
59 }
60