SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
+ switch_status_t status;
+
switch_assert(ah != NULL);
- return ah->asr_interface->asr_close(ah, flags);
+ status = ah->asr_interface->asr_close(ah, flags);
+
+ if (switch_test_flag(ah, SWITCH_ASR_FLAG_FREE_POOL)) {
+ switch_core_destroy_memory_pool(&ah->memory_pool);
+ }
+
+ return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_handle_t *dh)
{
- return dh->directory_interface->directory_close(dh);
+ switch_status_t status;
+
+ status = dh->directory_interface->directory_close(dh);
+
+ if (switch_test_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL)) {
+ switch_core_destroy_memory_pool(&dh->memory_pool);
+ }
+
+ return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
{
+ switch_status_t status;
+
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
switch_clear_flag(fh, SWITCH_FILE_OPEN);
- return fh->file_interface->file_close(fh);
+ status = fh->file_interface->file_close(fh);
+ if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
+ switch_core_destroy_memory_pool(&fh->memory_pool);
+ }
+
+ return status;
}