Skip to content

Commit 94acb11

Browse files
b2b_logic: fix crash if no B2B routes are set
This fixes a crash when the 'script_req_route'/'script_reply_route' module parameters are not set and b2b_init_request() is called with no route parameters.
1 parent 6c0203b commit 94acb11

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

modules/b2b_logic/records.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,21 @@ b2bl_tuple_t* b2bl_insert_new(struct sip_msg* msg, unsigned int hash_index,
325325

326326
tuple->hash_index = hash_index;
327327

328-
tuple->req_route =
329-
dup_ref_script_route_in_shm( init_params->req_route, 0);
330-
tuple->reply_route =
331-
dup_ref_script_route_in_shm( init_params->reply_route, 0);
332-
if (!tuple->req_route || !tuple->reply_route) {
333-
LM_ERR("failed to duplicate script route references\n");
334-
goto error;
328+
if (init_params->req_route) {
329+
tuple->req_route =
330+
dup_ref_script_route_in_shm( init_params->req_route, 0);
331+
if (!tuple->req_route) {
332+
LM_ERR("failed to duplicate script route reference\n");
333+
goto error;
334+
}
335+
}
336+
if (init_params->reply_route) {
337+
tuple->reply_route =
338+
dup_ref_script_route_in_shm( init_params->reply_route, 0);
339+
if (!tuple->reply_route) {
340+
LM_ERR("failed to duplicate script route reference\n");
341+
goto error;
342+
}
335343
}
336344

337345
if (set_tracer_func && msg && msg->msg_flags&tracer_msg_flag_filter)

0 commit comments

Comments
 (0)