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
iaxclient\lib\libiax2\src\iax.c patch file
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
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;
Logged In: YES
user_id=627618
Originator: NO
What are you trying to say with:
if (cur = schedq)
??? it seems ambiguous.
Logged In: YES
user_id=627618
Originator: NO
As-is the patch causes crashes in existing libiax2-using applications (namely iaxmodem).