| 3397 | |
| 3398 | |
| 3399 | void plugin_thdvar_cleanup(THD *thd) |
| 3400 | { |
| 3401 | size_t idx; |
| 3402 | plugin_ref *list; |
| 3403 | DBUG_ENTER("plugin_thdvar_cleanup"); |
| 3404 | |
| 3405 | #ifndef EMBEDDED_LIBRARY |
| 3406 | thd->session_tracker.sysvars.deinit(thd); |
| 3407 | my_free(thd->variables.redirect_url); |
| 3408 | thd->variables.redirect_url= 0; |
| 3409 | #endif |
| 3410 | my_free((char*) thd->variables.default_master_connection.str); |
| 3411 | thd->variables.default_master_connection.str= 0; |
| 3412 | thd->variables.default_master_connection.length= 0; |
| 3413 | |
| 3414 | mysql_mutex_lock(&LOCK_plugin); |
| 3415 | |
| 3416 | unlock_variables(thd, &thd->variables); |
| 3417 | cleanup_variables(&thd->variables); |
| 3418 | |
| 3419 | if ((idx= thd->lex->plugins.elements)) |
| 3420 | { |
| 3421 | list= ((plugin_ref*) thd->lex->plugins.buffer) + idx - 1; |
| 3422 | DBUG_PRINT("info",("unlocking %zu plugins", idx)); |
| 3423 | while ((uchar*) list >= thd->lex->plugins.buffer) |
| 3424 | intern_plugin_unlock(NULL, *list--); |
| 3425 | } |
| 3426 | |
| 3427 | reap_plugins(); |
| 3428 | mysql_mutex_unlock(&LOCK_plugin); |
| 3429 | |
| 3430 | reset_dynamic(&thd->lex->plugins); |
| 3431 | |
| 3432 | DBUG_VOID_RETURN; |
| 3433 | } |
| 3434 | |
| 3435 | |
| 3436 | /** |
no test coverage detected