static void dict_mysql_close(DICT *dict) { DICT_MYSQL *dict_mysql = (DICT_MYSQL *) dict; plmysql_dealloc(dict_mysql->pldb); cfg_parser_free(dict_mysql->parser); myfree(dict_mysql->username); myfree(dict_mysql->password); myfree(dict_mysql->dbname); myfree(dict_mysql->query); myfree(dict_mysql->result_format); if (dict_mysql->option_file) myfree(dict_mysql->option_file); if (dict_mysql->option_group) myfree(dict_mysql->option_group); #if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID >= 40000 if (dict_mysql->tls_key_file) myfree(dict_mysql->tls_key_file); if (dict_mysql->tls_cert_file) myfree(dict_mysql->tls_cert_file); if (dict_mysql->tls_CAfile) myfree(dict_mysql->tls_CAfile); if (dict_mysql->tls_CApath) myfree(dict_mysql->tls_CApath); if (dict_mysql->tls_ciphers) myfree(dict_mysql->tls_ciphers); #endif if (dict_mysql->hosts) argv_free(dict_mysql->hosts); if (dict_mysql->ctx) db_common_free_ctx(dict_mysql->ctx); if (dict->fold_buf) vstring_free(dict->fold_buf); dict_free(dict); }
static void dict_erlang_close(DICT *dict) { DICT_ERLANG *dict_erlang = (DICT_ERLANG *)dict; cfg_parser_free(dict_erlang->parser); if (dict_erlang->nodes) argv_free(dict_erlang->nodes); myfree(dict_erlang->cookie); myfree(dict_erlang->mod); myfree(dict_erlang->fun); if (dict_erlang->ctx) db_common_free_ctx(dict_erlang->ctx); if (dict->fold_buf) vstring_free(dict->fold_buf); dict_free(dict); }
static void dict_pgsql_close(DICT *dict) { DICT_PGSQL *dict_pgsql = (DICT_PGSQL *) dict; plpgsql_dealloc(dict_pgsql->pldb); cfg_parser_free(dict_pgsql->parser); myfree(dict_pgsql->username); myfree(dict_pgsql->password); myfree(dict_pgsql->dbname); myfree(dict_pgsql->query); myfree(dict_pgsql->result_format); if (dict_pgsql->hosts) argv_free(dict_pgsql->hosts); if (dict_pgsql->ctx) db_common_free_ctx(dict_pgsql->ctx); if (dict->fold_buf) vstring_free(dict->fold_buf); dict_free(dict); }
static void dict_sqlite_close(DICT *dict) { const char *myname = "dict_sqlite_close"; DICT_SQLITE *dict_sqlite = (DICT_SQLITE *) dict; if (msg_verbose) msg_info("%s: %s", myname, dict_sqlite->parser->name); if (sqlite3_close(dict_sqlite->db) != SQLITE_OK) msg_fatal("%s: close %s failed", myname, dict_sqlite->parser->name); cfg_parser_free(dict_sqlite->parser); myfree(dict_sqlite->dbpath); myfree(dict_sqlite->query); myfree(dict_sqlite->result_format); if (dict_sqlite->ctx) db_common_free_ctx(dict_sqlite->ctx); if (dict->fold_buf) vstring_free(dict->fold_buf); dict_free(dict); }
/********************************************************************** * public interface dict_mysql_close * unregister, disassociate from database, freeing appropriate memory **********************************************************************/ static void dict_mysql_close(DICT *dict) { int i; DICT_MYSQL *dict_mysql = (DICT_MYSQL *) dict; plmysql_dealloc(dict_mysql->pldb); cfg_parser_free(dict_mysql->name->parser); myfree(dict_mysql->name->username); myfree(dict_mysql->name->password); myfree(dict_mysql->name->dbname); myfree(dict_mysql->name->table); myfree(dict_mysql->name->select_field); myfree(dict_mysql->name->where_field); myfree(dict_mysql->name->additional_conditions); for (i = 0; i < dict_mysql->name->len_hosts; i++) { myfree(dict_mysql->name->hostnames[i]); } myfree((char *) dict_mysql->name->hostnames); myfree((char *) dict_mysql->name); dict_free(dict); }
static void dict_ldap_close(DICT *dict) { char *myname = "dict_ldap_close"; DICT_LDAP *dict_ldap = (DICT_LDAP *) dict; LDAP_CONN *conn = DICT_LDAP_CONN(dict_ldap); BINHASH_INFO *ht = dict_ldap->ht; if (--conn->conn_refcount == 0) { if (conn->conn_ld) { if (msg_verbose) msg_info("%s: Closed connection handle for LDAP source %s", myname, dict_ldap->ldapsource); ldap_unbind(conn->conn_ld); } binhash_delete(conn_hash, ht->key, ht->key_len, myfree); } cfg_parser_free(dict_ldap->parser); myfree(dict_ldap->ldapsource); myfree(dict_ldap->server_host); myfree(dict_ldap->search_base); if (dict_ldap->domain) match_list_free(dict_ldap->domain); myfree(dict_ldap->query_filter); if (dict_ldap->result_filter) myfree(dict_ldap->result_filter); argv_free(dict_ldap->result_attributes); myfree(dict_ldap->bind_dn); myfree(dict_ldap->bind_pw); #ifdef LDAP_API_FEATURE_X_OPENLDAP myfree(dict_ldap->tls_ca_cert_file); myfree(dict_ldap->tls_ca_cert_dir); myfree(dict_ldap->tls_cert); myfree(dict_ldap->tls_key); myfree(dict_ldap->tls_random_file); myfree(dict_ldap->tls_cipher_suite); #endif dict_free(dict); }