check value before using. Found by Klockwork (www.klocwork.com)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8431 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-05-16 14:35:41 +00:00
parent 35dc6b0412
commit 3921baa719

View File

@ -581,12 +581,14 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void)
SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext) SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext)
{ {
const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext); const char *check;
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
switch_assert(type); switch_assert(type);
switch_assert(ext); switch_assert(ext);
check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
if (!check) { if (!check) {
char *ptype = switch_core_permanent_strdup(type); char *ptype = switch_core_permanent_strdup(type);
char *ext_list = strdup(ext); char *ext_list = strdup(ext);