Menu

#36 Memory Leak Patch #4 - IAX Destroy (Resubmit #1820274)

open
nobody
None
5
2007-11-06
2007-11-06
Anonymous
No

This a patch file for the source file:
iax.c

These changes plug memory leaks, found while testing. This fix was mainly for the situation when you startup and immediately shutdown the IAXclient library, without ever placing or answering a call. Where the sequence of calls is simply as follows:
iaxc_initialize(1);
iaxc_set_event_callback(ClientEventCallback);
m_nRegisteredId = iaxc_register(lpszUser, lpszPassword, lpszDomain);
iaxc_set_callerid(lpszUserDisplay, lpszUser);
iaxc_set_formats(IAXC_FORMAT_GSM, IAXC_FORMAT_ULAW | IAXC_FORMAT_GSM | IAXC_FORMAT_SPEEX);
iaxc_set_filters(IAXC_FILTER_DENOISE | IAXC_FILTER_AGC | IAXC_FILTER_AAGC | IAXC_FILTER_CN);
iaxc_set_silence_threshold(AUDIO_SILENCE_THRESHOLD);
iaxc_unregister(m_nRegisteredId);
iaxc_shutdown();
Admittedly, this is not a normal case, but it is not out of the realm of reality. Anyway, after doing this, I noticed a memory leak in the frame, and frame data of the SCHEDQ. As well as the SCHEDQ itself. So therein lies the additional code to iax_destroy, since that made the most sense where to put the cleanup.

This was submitted once before as #1820274, but this time provided as a unified diff.
Submitted by Teri Schoech, tschoech@pixion.com

Discussion

  • Nobody/Anonymous

    iaxclient\lib\libiax2\src\iax.c patch file

     
  • Lee Howard

    Lee Howard - 2007-12-14

    Logged In: YES
    user_id=627618
    Originator: NO

    iax.c: In function `iax_destroy':
    iax.c:3036: error: `boolean' undeclared (first use in this function)
    iax.c:3036: error: (Each undeclared identifier is reported only once
    iax.c:3036: error: for each function it appears in.)
    iax.c:3036: error: syntax error before "in_session"
    iax.c:3040: warning: suggest parentheses around assignment used as truth value
    iax.c:3054: error: `in_session' undeclared (first use in this function)

    I'll attach a new patch that works for gcc C

     
  • Lee Howard

    Lee Howard - 2007-12-14

    Logged In: YES
    user_id=627618
    Originator: NO

    It seems that I can't add attachments to this report. So just change the in_session declaration to be:

    int in_session = (session != NULL) && session->peercallno ? 1 : 0;

     
  • Lee Howard

    Lee Howard - 2007-12-14

    Logged In: YES
    user_id=627618
    Originator: NO

    What are you trying to say with:

    if (cur = schedq)

    ??? it seems ambiguous.

     
  • Lee Howard

    Lee Howard - 2007-12-15

    Logged In: YES
    user_id=627618
    Originator: NO

    As-is the patch causes crashes in existing libiax2-using applications (namely iaxmodem).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.