MT#64451 Kamailio memory leak on pv_headers

Free shm memory taken before and inside pvh_merge_uri()
in case of error.

Change-Id: I219436e5a8adabc27326faa2c3ba8aa26d3fe003
(cherry picked from commit ec926092f2)
(cherry picked from commit 3de26013ea)
mr14.1.1
Alessio Garzi 4 weeks ago
parent 2eba04b684
commit 31fef3f2ee

@ -43,6 +43,7 @@ sipwise/http_client-add-method-parameter-to-http_connect.patch
sipwise/lost-add-method-parameter-to-http_connect-calls.patch
sipwise/usrloc-don-t-synchronize-on-destroy-for-DB_ONLY.patch
sipwise/presence_offline_cleanup.patch
sipwise/pvheaders_memleak.patch
### active development
sipwise/permissions-don-t-allow-reloads-in-the-middle-of-ong.patch
sipwise/dlg_get_var_error_more_verbose_on_dlg

@ -0,0 +1,31 @@
--- a/src/modules/pv_headers/pvh_xavp.c
+++ b/src/modules/pv_headers/pvh_xavp.c
@@ -713,7 +713,13 @@ xavp_c_data_t *pvh_set_parsed(
return c_data;
err:
- // how can I call?? pvh_xavi_free_data(c_data, shm_free);
+ if(c_data != NULL) {
+ if(c_data->value.s != NULL) {
+ shm_free(c_data->value.s);
+ }
+ shm_free(c_data);
+ c_data = NULL;
+ }
return NULL;
}
@@ -886,6 +892,13 @@ int pvh_set_uri(struct sip_msg *msg, pv_
err:
if(pv_format)
pv_elem_free_all(pv_format);
+ if(c_data != NULL) {
+ if(c_data->value.s != NULL) {
+ shm_free(c_data->value.s);
+ }
+ shm_free(c_data);
+ c_data = NULL;
+ }
return -1;
}
Loading…
Cancel
Save