FS-4860 --resolve This seems to have come from a malformed file_string in the ringback var

This commit is contained in:
Anthony Minessale 2012-11-21 13:06:28 -06:00
parent 1f06fe909c
commit cf32d24b5d
2 changed files with 12 additions and 1 deletions

View File

@ -4476,8 +4476,13 @@ static switch_status_t next_file(switch_file_handle_t *handle)
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error finding the folder path section in '%s'\n", path);
}
}
if (switch_file_exists(file, handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] does not exist.\n", file);
goto top;
}
if (switch_core_file_open(&context->fh, file, handle->channels, handle->samplerate, handle->flags, NULL) != SWITCH_STATUS_SUCCESS) {
goto top;
}

View File

@ -76,6 +76,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL);
}
if (switch_directory_exists(file_path, fh->memory_pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] is a directory not a file.\n", file_path);
goto fail;
}
if ((rhs = strstr(file_path, SWITCH_URL_SEPARATOR))) {
switch_copy_string(stream_name, file_path, (rhs + 1) - file_path);
@ -198,6 +202,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
fail:
switch_clear_flag(fh, SWITCH_FILE_OPEN);
if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
switch_core_destroy_memory_pool(&fh->memory_pool);
}