Re: [pjmedia][confbridge] Memory leak with third party resampling

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


Hi Andreas,

We have reviewed your patch and have integrated it into our codebase (#2234).
However, I forgot to tell you that you would need to sign the contribution agreement beforehand.
If you haven't, could you please sign our contribution agreement here:

Thanks again for the contribution.

Best Regards,


On Wed, Sep 18, 2019 at 5:59 PM Andreas Wehrmann <a.wehrmann@xxxxxxxxxx> wrote:
Hey folks,

I've found a memleak in the conference bridge.
When you configure PJ to use Speex for resampling,
a memory leak occurs when a conference port is removed
that has resample instances associated with it.

Resamples instances are created during the call to create_conf_port()
but are not destroyed anywhere. This in combination with third party
leads to a memory leak because third party implementations (like Speex)
do allocate memory internally.
The memory allocated internally by any external library is not
tracked/managed by PJ of course,
so simply "forgetting" the resample instance doesn't work here.

I've found this by accident while I was looking after another problem in
my code.
Please see the attached patch for a fix of this issue.
I ran my app through Valgrind's memcheck and it didn't find any other

While I was looking at the conference bridge, I noticed something else,
please see the comments marked "AWH".
I think there might be another leak related to passive ports which
brings me to my next point:

The function pjmedia_conf_add_passive_port() is (according to the log
statement inside) deprecated since pjsip 1.3 (which feels like eons away).
How about #ifdef'ing the function out by default?
That way it would not appear in the public API by default and if
somebody really needed it,
they could still enable it with an #ifdef in config_site.h
This is merely meant to make people aware that this function is going away.
Log statements can be ignored but a missing function cannot and a
developer would have to become active to reenable this function.
Just an idea...

Best regards,

Andreas Wehrmann

Visit our blog:

pjsip mailing list
Visit our blog:

pjsip mailing list

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux