mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
Merge pull request #452 from dragos-oancea/mod_java-garbage-val
[mod_java] scan-build: Undefined or garbage value returned to caller - run_dtmf_callback()
This commit is contained in:
commit
fdca16a3b0
@ -207,7 +207,7 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
jstring digits = NULL;
|
jstring digits = NULL;
|
||||||
jint res;
|
jint res;
|
||||||
jstring callbackResult = NULL;
|
jstring callbackResult = NULL;
|
||||||
switch_status_t status;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
if (cb_state.function == NULL)
|
if (cb_state.function == NULL)
|
||||||
{
|
{
|
||||||
@ -229,7 +229,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
onDTMF = env->GetMethodID(klass, "onDTMF", "(Ljava/lang/Object;ILjava/lang/String;)Ljava/lang/String;");
|
onDTMF = env->GetMethodID(klass, "onDTMF", "(Ljava/lang/Object;ILjava/lang/String;)Ljava/lang/String;");
|
||||||
if (onDTMF == NULL)
|
if (onDTMF == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +237,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
digits = env->NewStringUTF((char*)input);
|
digits = env->NewStringUTF((char*)input);
|
||||||
if (digits == NULL)
|
if (digits == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
callbackResult = (jstring) env->CallObjectMethod((jobject)cb_state.function, onDTMF, digits, itype, (jstring)cb_state.funcargs);
|
callbackResult = (jstring) env->CallObjectMethod((jobject)cb_state.function, onDTMF, digits, itype, (jstring)cb_state.funcargs);
|
||||||
@ -248,8 +246,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
status = process_callback_result((char*) callbackResultUTF);
|
status = process_callback_result((char*) callbackResultUTF);
|
||||||
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
|
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
}
|
}
|
||||||
else if (itype == SWITCH_INPUT_TYPE_EVENT)
|
else if (itype == SWITCH_INPUT_TYPE_EVENT)
|
||||||
{
|
{
|
||||||
@ -265,32 +261,27 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
env->FindClass("org/freeswitch/Event");
|
env->FindClass("org/freeswitch/Event");
|
||||||
if (Event == NULL)
|
if (Event == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
constructor = env->GetMethodID(Event, "<init>", "()V");
|
constructor = env->GetMethodID(Event, "<init>", "()V");
|
||||||
if (constructor == NULL)
|
if (constructor == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
event = env->CallStaticObjectMethod(Event, constructor);
|
event = env->CallStaticObjectMethod(Event, constructor);
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBody = env->GetMethodID(Event, "setBody", "(Ljava/lang/String;)V");
|
setBody = env->GetMethodID(Event, "setBody", "(Ljava/lang/String;)V");
|
||||||
if (setBody == NULL)
|
if (setBody == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
body = env->NewStringUTF(switch_event->body);
|
body = env->NewStringUTF(switch_event->body);
|
||||||
if (body == NULL)
|
if (body == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
env->CallVoidMethod(event, setBody, body);
|
env->CallVoidMethod(event, setBody, body);
|
||||||
@ -300,7 +291,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
addHeader = env->GetMethodID(Event, "addHeader", "(Ljava/lang/String;Ljava/lang/String;)V");
|
addHeader = env->GetMethodID(Event, "addHeader", "(Ljava/lang/String;Ljava/lang/String;)V");
|
||||||
if (addHeader == NULL)
|
if (addHeader == NULL)
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
for (header = switch_event->headers; header; header = header->next)
|
for (header = switch_event->headers; header; header = header->next)
|
||||||
@ -324,7 +314,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
env->DeleteLocalRef(value);
|
env->DeleteLocalRef(value);
|
||||||
if (env->ExceptionOccurred())
|
if (env->ExceptionOccurred())
|
||||||
{
|
{
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,8 +325,6 @@ switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t
|
|||||||
status = process_callback_result((char*) callbackResultUTF);
|
status = process_callback_result((char*) callbackResultUTF);
|
||||||
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
|
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
status = SWITCH_STATUS_FALSE;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (Event != NULL)
|
if (Event != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user