linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Memory leak while handling sdp


From: damico
Subject: [Linphone-developers] Memory leak while handling sdp
Date: Tue, 30 Sep 2008 12:31:37 +0200
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

Hi Simon,
I think there are some memory leak related to sdp body in exevents. Maybe because some time ago exosip change its behaviour and now eXosip_get_sdp_info() give a copy instead a reference. I saw that you have fix it in linphone_call_ringing() but there are some other place where after a call eXosip_get_sdp_info() there aren't any sdp_message_free(). These are potentially memory leaks.

I hope that patch fix these issues.

Regards

--Michele

### Eclipse Workspace Patch 1.0
#P linphone_upstream
Index: coreapi/exevents.c
===================================================================
RCS file: /sources/linphone/linphone/coreapi/exevents.c,v
retrieving revision 1.62
diff -u -r1.62 exevents.c
--- coreapi/exevents.c    31 Aug 2008 20:49:46 -0000    1.62
+++ coreapi/exevents.c    30 Sep 2008 10:22:02 -0000
@@ -61,12 +61,12 @@
    int err;
    if (call==NULL){
        ms_warning("No call to accept.");
-        return 0;
+        goto end;
    }
    linphone_call_proceeding(lc,ev);
    call->auth_pending=FALSE;
    if (call->state==LCStateAVRunning){
-        return 0; /*already accepted*/
+        goto end; /*already accepted*/
    }
    linphone_call_init_media_params(call);
    if (!lc->sip_conf.sdp_200_ack){
@@ -90,7 +90,10 @@
ms_error("Incompatible SDP offer received in 200Ok, need to abort the call");
        linphone_core_terminate_call(lc,NULL);
    }
-    return 0;
+    goto end;
+    end:
+        sdp_message_free(sdp);
+    return ret;
}


@@ -334,8 +337,9 @@
        lc->call=NULL;
    }
    end:
-    osip_free(from);
-    osip_free(to);
+        sdp_message_free(sdp);
+        osip_free(from);
+        osip_free(to);
    return 0;
}

@@ -345,6 +349,9 @@
        sdp_context_read_answer(lc->call->sdpctx,sdp);
        linphone_connect_incoming(lc);
    }
+    goto end;
+    end:
+        sdp_message_free(sdp);
}

void linphone_handle_reinvite(LinphoneCore *lc, eXosip_event_t *ev){
@@ -358,7 +365,7 @@
        eXosip_lock();
        eXosip_call_send_answer(ev->tid,603,NULL);
        eXosip_unlock();
-        return;
+        goto end;
    }
    ctx=call->sdpctx;
    /* get the result of the negociation */
@@ -374,7 +381,7 @@
            ms_warning("Reinvite for closed call ?");
                        eXosip_unlock();
                        linphone_core_stop_media_streams(lc);
-            return ;
+            goto end;
        }
answer=call->sdpctx->answerstr; /* takes the sdp already computed*/
        linphone_set_sdp(msg,answer);
@@ -386,6 +393,9 @@
        eXosip_call_send_answer(ev->tid,status,NULL);
        eXosip_unlock();
    }
+    goto end;
+    end:
+        sdp_message_free(sdp);
}

void linphone_do_automatic_redirect(LinphoneCore *lc, const char *contact){





reply via email to

[Prev in Thread] Current Thread [Next in Thread]