Module: kamailio Branch: master Commit: 418a1017a58e87a9fe9085f75183bcbfba3f9022 URL: https://github.com/kamailio/kamailio/commit/418a1017a58e87a9fe9085f75183bcbf...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-06-09T08:45:31+02:00
core: destroy the x/avp lists on msg env data pop
---
Modified: src/core/srapi.c Modified: src/core/srapi.h
---
Diff: https://github.com/kamailio/kamailio/commit/418a1017a58e87a9fe9085f75183bcbf... Patch: https://github.com/kamailio/kamailio/commit/418a1017a58e87a9fe9085f75183bcbf...
---
diff --git a/src/core/srapi.c b/src/core/srapi.c index 31eb2808835..3be80b4d075 100644 --- a/src/core/srapi.c +++ b/src/core/srapi.c @@ -79,6 +79,27 @@ sr_cfgenv_t *sr_cfgenv_get(void) static ksr_msg_env_data_t _ksr_msg_env_stack[KSR_MSG_ENV_STACK_SIZE]; static int _ksr_msg_env_stack_idx = 0;
+/** + * + */ +int ksr_msg_env_data_destroy(ksr_msg_env_data_t *denv) +{ + if(denv == NULL) { + return -1; + } + destroy_avp_list(&denv->avps_uri_from); + destroy_avp_list(&denv->avps_uri_to); + destroy_avp_list(&denv->avps_user_from); + destroy_avp_list(&denv->avps_user_to); + destroy_avp_list(&denv->avps_domain_from); + destroy_avp_list(&denv->avps_domain_to); + xavp_destroy_list(&denv->xavps); + xavp_destroy_list(&denv->xavus); + xavp_destroy_list(&denv->xavis); + + return 0; +} + /** * */ @@ -127,8 +148,8 @@ int ksr_msg_env_pop(ksr_msg_env_links_t *menv) return -1; }
- /* current msg x/avp lists are expected to be cleaned up - * - just replace and pop */ + ksr_msg_env_data_destroy(&_ksr_msg_env_stack[_ksr_msg_env_stack_idx - 1]); + set_route_type(menv->route_type);
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, menv->avps_uri_from); diff --git a/src/core/srapi.h b/src/core/srapi.h index d4c64c1976a..0a1593fe93a 100644 --- a/src/core/srapi.h +++ b/src/core/srapi.h @@ -71,5 +71,6 @@ typedef struct ksr_msg_env_links
int ksr_msg_env_links_push(ksr_msg_env_links_t *menv); int ksr_msg_env_links_pop(ksr_msg_env_links_t *menv); +int ksr_msg_env_data_destroy(ksr_msg_env_data_t *denv);
#endif