It seems that sometimes "show visdn interfaces" lists a channel with a
freed visdn_chan pointer.

*CLI> show channels
Channel              Location             State   Application(Data)
0 active channels
0 active calls

Unfortunately, there's still a channel sitting on the interface for
whatever reason:

*CLI> show visdn interfaces
Interface  Role Mode TEI Status        Calls visdn0     NT   P2MP Online
     0 visdn1     TE   P2P  0   Online        1 visdn2     TE P2P  0
Online        0 *CLI>

A "show visdn channels" causes a crash in this situation.

This patch prevents the crash and looks reasonable regardless, but it
doesn't fix the root cause of the problem -- I haven't found it yet.

diff --git a/chan_visdn/chan_visdn.c b/chan_visdn/chan_visdn.c
index ca2ffd1..e445aa5 100644
--- a/chan_visdn/chan_visdn.c
+++ b/chan_visdn/chan_visdn.c
@@ -4690,9 +4690,10 @@ static void visdn_print_call_summary_ent
        if (ast_chan) {
                struct visdn_chan *visdn_chan = to_visdn_chan(ast_chan);

-               ast_cli(fd, "%s%s",
-                       visdn_chan->number,
-                       visdn_chan->sending_complete ? "(SC)" : "");
+               if(visdn_chan && visdn_chan->number)
+                       ast_cli(fd, "%s%s",
+                               visdn_chan->number,
+                               visdn_chan->sending_complete ? "(SC)" : "");
        }

        ast_cli(fd, "\n");
@@ -4812,6 +4812,10 @@ static void visdn_cli_print_call(int fd,
                struct visdn_chan *visdn_chan = to_visdn_chan(ast_chan);

                ast_cli(fd, "------ Asterisk Channel\n");
+               if(!visdn_chan) {
+                       ast_cli(fd, "... visdn channel has been freed ...\n");
+                       return;
+               }

                ast_cli(fd,
                        "Number               : %s%s\n"



-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Army Sergeant: "Gump, what is your sole purpose in this army?"
Forrest Gump: "To do whatever you tell me, Drill Sergeant!"
Army Sergeant: "Gump, you are a @#$%&! genius"...

_______________________________________________
Visdn-hackers mailing list
[email protected]
https://mailman.uli.it/mailman/listinfo/visdn-hackers

Reply via email to