@@ -295,7 +295,7 @@ int async_script_launch(struct sip_msg *msg, struct action* a,
295
295
return -1 ;
296
296
}
297
297
298
- if ( (ctx = shm_malloc (sizeof (async_launch_ctx ) + (report_route_param ?report_route_param -> len :0 )))== NULL ) {
298
+ if ( (ctx = shm_malloc (sizeof (async_launch_ctx ) + ( ( report_route && report_route_param ) ?report_route_param -> len :0 )))== NULL ) {
299
299
LM_ERR ("failed to allocate new ctx, forcing sync mode\n" );
300
300
return -1 ;
301
301
}
@@ -339,20 +339,22 @@ int async_script_launch(struct sip_msg *msg, struct action* a,
339
339
340
340
/* ctx is to be used from this point further */
341
341
342
- ctx -> report_route = dup_ref_script_route_in_shm ( report_route , 0 );
343
- if (!ref_script_route_is_valid (ctx -> report_route )) {
344
- LM_ERR ("failed dup resume route -> act in sync mode\n" );
345
- goto sync ;
346
- }
342
+ if (report_route ) {
343
+ ctx -> report_route = dup_ref_script_route_in_shm ( report_route , 0 );
344
+ if (!ref_script_route_is_valid (ctx -> report_route )) {
345
+ LM_ERR ("failed dup resume route -> act in sync mode\n" );
346
+ goto sync ;
347
+ }
347
348
348
- if (report_route_param ) {
349
- ctx -> report_route_param .s = (char * )(ctx + 1 );
350
- ctx -> report_route_param .len = report_route_param -> len ;
351
- memcpy (ctx -> report_route_param .s , report_route_param -> s ,
352
- report_route_param -> len );
353
- } else {
354
- ctx -> report_route_param .s = NULL ;
355
- ctx -> report_route_param .len = 0 ;
349
+ if (report_route_param ) {
350
+ ctx -> report_route_param .s = (char * )(ctx + 1 );
351
+ ctx -> report_route_param .len = report_route_param -> len ;
352
+ memcpy (ctx -> report_route_param .s , report_route_param -> s ,
353
+ report_route_param -> len );
354
+ } else {
355
+ ctx -> report_route_param .s = NULL ;
356
+ ctx -> report_route_param .len = 0 ;
357
+ }
356
358
}
357
359
358
360
if (async_status != ASYNC_NO_FD ) {
0 commit comments