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