[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] Memory leak on outgoing call
From: |
Simon Morlat |
Subject: |
Re: [Linphone-developers] Memory leak on outgoing call |
Date: |
Wed, 14 May 2008 12:49:06 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
Your proposal is risky: what if the allocated PayloadType is still referenced
by some other portion of code somewhere else ?
Taking the decision of freeing the PayloadType is only relevant to the
application.
I prefer the application to check that the payload type slot is empty using
rtp_profile_get_payload() before calling rtp_profile_set_payload().
Simon
Le Friday 18 April 2008 18:37:31 damico, vous avez écrit :
> Hi all,
>
> I found a little memory leak on outgoing mail: when in
> linphone_payload_is_supported the payload is cloned and then add it to
> profile. So, the function that add the payload to profile in oRTP is
>
> void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt){
> if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
> ortp_error("Bad index %i",idx);
> return;
> }
> prof->payload[idx]=pt;
> }
>
> That function doesn't care if prof->payload[idx] is yet fill and the
> flags is PAYLOAD_TYPE_ALLOCATED. When we consider the incoming call the
> remote profile is empty and the calls to rtp_profile_set_payload() don't
> generate any memory leak.
>
> I'm proposing to fix it in oRTP by
> void rtp_profile_set_payload(RtpProfile *prof, int idx, PayloadType *pt){
> PayloadType *payload;
> if (idx<0 || idx>=RTP_PROFILE_MAX_PAYLOADS) {
> ortp_error("Bad index %i",idx);
> return;
> }
> payload=rtp_profile_get_payload(prof,idx);
> if (payload!=NULL && (payload->flags & PAYLOAD_TYPE_ALLOCATED))
> payload_type_destroy(payload);
> prof->payload[idx]=pt;
> }
>
>
> Any comments?
>
> Regards
>
> --Michele
>
>
> _______________________________________________
> Linphone-developers mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/linphone-developers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Linphone-developers] Memory leak on outgoing call,
Simon Morlat <=