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