-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
… struct to tm - This avoids a race condition that may happen processing tm_request callbacl - Allows to identify uniquely a ka_dest record
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,12 +67,14 @@ ticks_t ka_check_timer(ticks_t ticks, struct timer_ln* tl, void* param) | |
return (ticks_t)(0); /* stops the timer */ | ||
} | ||
|
||
str *uuid = shm_malloc(sizeof(str)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
NGSegovia
Author
Owner
|
||
ka_str_copy(uuid, &(ka_dest->uuid), NULL); | ||
/* Send ping using TM-Module. | ||
* int request(str* m, str* ruri, str* to, str* from, str* h, | ||
* str* b, str *oburi, | ||
* transaction_cb cb, void* cbp); */ | ||
set_uac_req(&uac_r, &ka_ping_method, 0, 0, 0, TMCB_LOCAL_COMPLETED, | ||
ka_options_callback, (void *)ka_dest); | ||
ka_options_callback, (void *)uuid); | ||
|
||
if(tmb.t_request(&uac_r, &ka_dest->uri, &ka_dest->uri, &ka_ping_from, | ||
&ka_outbound_proxy) | ||
|
@@ -99,8 +101,15 @@ static void ka_options_callback( | |
|
||
char *state_routes[] = {"", "keepalive:dst-up", "keepalive:dst-down"}; | ||
|
||
//NOTE: how to be sure destination is still allocated ? | ||
ka_dest_t *ka_dest = (ka_dest_t *)(*ps->param); | ||
str *uuid = (str *)(*ps->param); | ||
|
||
// Retrieve ka_dest by uuid from destination list | ||
ka_dest_t *ka_dest=0,*hollow=0; | ||
if (!ka_find_destination_by_uuid(*uuid, &ka_dest, &hollow)) { | ||
LM_ERR("Couldn't find destination \r\n"); | ||
return; | ||
} | ||
shm_free(uuid); | ||
|
||
uri.s = t->to.s + 5; | ||
uri.len = t->to.len - 8; | ||
|
3 comments
on commit aaded16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these new exception handlers also free memory before leaving so we don't have more memory leaks?
if (!ka_find_destination_by_uuid(*uuid, &ka_dest, &hollow)) {
LM_ERR("Couldn't find destination \r\n");
return;
}
if(sruid_init(&ka_sruid, '-', "ka", SRUID_INC) < 0) {
return -1;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @davesoft11 ,
The first one is already addressed in https://github.com/kamailio/kamailio/pull/2474/files Pull request (these changes has been already merged).
About the second one there is no "sruid_destroy" function, and I checked in other modules just initialized and used the same way. Anyway that happens in the mod_init function so it's likely to be destroyed anyway in Kamailio's stop.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first one is already addressed in https://github.com/kamailio/kamailio/pull/2474/files Pull request (these changes has been already merged).
About the second one there is no "sruid_destroy" function, and I checked in other modules just initialized and used the same way. Anyway that happens in the mod_init function so it's likely to be destroyed anyway in Kamailio's stop.
Okay, thanks for the reply.
@NGSegovia , Memory allocated here is not freed at the end of function ? Could this be causing this issue ?
kamailio#2448 (comment)