Summary:ASTERISK-06807: [patch] Two memory leaks in ast_play_and_prepend -> app.c rewrite
Reporter:Andrey S Pankov (casper)Labels:
Date Opened:2006-04-18 18:43:44Date Closed:2006-05-04 16:26:45
Versions:Frequency of
Environment:Attachments:( 0) app.c-formatting.diff
Description:This is mainly ast_play_and_record and ast_play_and_prepend rewrite:
- fix a leak when we break without ast_frfree(f)
- do ast_frfree(fr) when adding the original file to stream
- do not call ast_frfree(f) before break, instead do it just after for(;;){}
- do not call ast_waitstream if ast_streamfile failed
- localize some variables
- some other minor things
Comments:By: Andrey S Pankov (casper) 2006-04-24 17:13:14

Updated to the latest svn. At least it compiles... :)

By: Serge Vecher (serge-v) 2006-05-04 13:14:48

casper: in order to expedite the review of this patch, can you please produce one that eliminates the memory leaks and file the whitespace patch separately?


By: Andrey S Pankov (casper) 2006-05-04 13:28:46

vechers: you missed the point... it's not a whitespace change patch, it's a
rewrite of two identical functions in order they have one core with branching
where needed.

By: Serge Vecher (serge-v) 2006-05-04 13:35:22

casper: your patch, amongst fixes and rewrites, contains whitespace fixes, such as:
- stringp=fmts;
+ stringp = fmts;
- end=start;
- for (x=0;x<fmtcnt;x++) {
+ end = start;
+ for (x = 0; x < fmtcnt; x++) {

I am asking you to remove these whitespace changes (as per the bug guidelines) and file those in a separate bug report.

Thank you!

By: Andrey S Pankov (casper) 2006-05-04 14:33:56

3-nospace.diff is in 'diff -uw' format
3.diff is in 'diff -U3' format

By: BJ Weschke (bweschke) 2006-05-04 15:29:44

Committed to /trunk. Thanks!

By: Andrey S Pankov (casper) 2006-05-04 15:49:16

To upload formatting...

The only thing fixed is here...

-       if (outmsg > 1) {
-               /* Let them know it worked */
+       if (outmsg == 2) {
               ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
-       }
+       }

outmsg is never set to the value higher than 2.

By: BJ Weschke (bweschke) 2006-05-04 16:03:39


By: Andrey S Pankov (casper) 2006-05-04 16:06:54

And now it's a bit of formatting... ;)

By: Andrey S Pankov (casper) 2006-05-04 16:21:55

vechers: that's not the way to edit patches :) (manually I mean).
Your patch will fail at the last chunk.

By: BJ Weschke (bweschke) 2006-05-04 16:26:44

take #3 committed. pls - if there are any more changes, let's open a new bug so we don't lose track of the attachments in the bugs in mantis. Thanks!