xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-perl/close.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: close.c,v 1.1.1.6 2018/02/06 01:53:18 christos Exp $	*/
2 
3 /* $OpenLDAP$ */
4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5  *
6  * Copyright 1999-2017 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 "../config.h"
22 /**********************************************************
23  *
24  * Close
25  *
26  **********************************************************/
27 
28 int
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
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