Module: sip-router
Branch: master
Commit: ab21b25652a8a1b44c1ec1ece01767d24e0ba33b
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ab21b25…
Author: Timo Reimann <timo.reimann(a)1und1.de>
Committer: Timo Reimann <timo.reimann(a)1und1.de>
Date: Fri Aug 12 14:08:02 2011 +0200
modules_k/dialog: Fix a bug that would cause a segfault when
caller bind address information could not be retrieved from
database and "dlg_list" was fifo-issued.
- Check nulliness of dlg->bind_addr[DLG_CALLER_LEG] before
printing.
(May be NULL when server doesn't feel responsible for a bound
address loaded from dialog database.)
- Move check-and-print code for both directions (caller and
callee) next to each other.
---
modules_k/dialog/dlg_hash.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/modules_k/dialog/dlg_hash.c b/modules_k/dialog/dlg_hash.c
index 4bf402c..412440a 100644
--- a/modules_k/dialog/dlg_hash.c
+++ b/modules_k/dialog/dlg_hash.c
@@ -884,11 +884,25 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl,
if(node1 == 0)
goto error;
- node1 = add_mi_node_child(node, 0,"caller_bind_addr",16,
- dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s,
+ if (dlg->bind_addr[DLG_CALLER_LEG]) {
+ node1 = add_mi_node_child(node, 0,
+ "caller_bind_addr",16,
+ dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s,
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len);
- if(node1 == 0)
- goto error;
+ } else {
+ node1 = add_mi_node_child(node, 0,
+ "caller_bind_addr",16,0,0);
+ }
+
+ if (dlg->bind_addr[DLG_CALLEE_LEG]) {
+ node1 = add_mi_node_child(node, 0,
+ "callee_bind_addr",16,
+ dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s,
+ dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len);
+ } else {
+ node1 = add_mi_node_child(node, 0,
+ "callee_bind_addr",16,0,0);
+ }
node1 = add_mi_node_child(node, MI_DUP_VALUE, "to_uri", 6,
dlg->to_uri.s, dlg->to_uri.len);
@@ -918,15 +932,6 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl,
if(node1 == 0)
goto error;
- if (dlg->bind_addr[DLG_CALLEE_LEG]) {
- node1 = add_mi_node_child(node, 0,
- "callee_bind_addr",16,
- dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s,
- dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len);
- } else {
- node1 = add_mi_node_child(node, 0,
- "callee_bind_addr",16,0,0);
- }
if(node1 == 0)
goto error;