Commit 43186ab4 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix memory leaks.

parent c7ba1b8e
......@@ -3724,8 +3724,10 @@ JNIEXPORT void JNICALL Java_org_linphone_core_PresenceServiceImpl_unref(JNIEnv *
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceServiceImpl_getId(JNIEnv *env, jobject jobj, jlong ptr) {
LinphonePresenceService *service = (LinphonePresenceService *)ptr;
const char *cid = linphone_presence_service_get_id(service);
return cid ? env->NewStringUTF(cid) : NULL;
char *cid = linphone_presence_service_get_id(service);
jstring jid = cid ? env->NewStringUTF(cid) : NULL;
if (cid) ms_free(cid);
return jid;
}
/*
......@@ -3767,8 +3769,10 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceServiceImpl_setBasicStatus
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_PresenceServiceImpl_getContact(JNIEnv *env, jobject jobj, jlong ptr) {
LinphonePresenceService *service = (LinphonePresenceService *)ptr;
const char *ccontact = linphone_presence_service_get_contact(service);
return ccontact ? env->NewStringUTF(ccontact) : NULL;
char *ccontact = linphone_presence_service_get_contact(service);
jstring jcontact = ccontact ? env->NewStringUTF(ccontact) : NULL;
if (ccontact) ms_free(ccontact);
return jcontact;
}
/*
......@@ -3854,8 +3858,10 @@ JNIEXPORT void JNICALL Java_org_linphone_core_PresencePersonImpl_unref(JNIEnv *e
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_PresencePersonImpl_getId(JNIEnv *env, jobject jobj, jlong ptr) {
LinphonePresencePerson *person = (LinphonePresencePerson *)ptr;
const char *cid = linphone_presence_person_get_id(person);
return cid ? env->NewStringUTF(cid) : NULL;
char *cid = linphone_presence_person_get_id(person);
jstring jid = cid ? env->NewStringUTF(cid) : NULL;
if (cid) ms_free(cid);
return jid;
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment