[sr-dev] git:master:e0f95ea7: drouting: free max val for time recurrence struct on update if already set

Daniel-Constantin Mierla miconda at gmail.com
Thu Jan 11 12:18:28 CET 2018


Module: kamailio
Branch: master
Commit: e0f95ea7fc691f976564b07436848673c633195d
URL: https://github.com/kamailio/kamailio/commit/e0f95ea7fc691f976564b07436848673c633195d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-01-11T12:16:47+01:00

drouting: free max val for time recurrence struct on update if already set

- reported by Uri Shacked

---

Modified: src/modules/drouting/dr_time.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e0f95ea7fc691f976564b07436848673c633195d.diff
Patch: https://github.com/kamailio/kamailio/commit/e0f95ea7fc691f976564b07436848673c633195d.patch

---

diff --git a/src/modules/drouting/dr_time.c b/src/modules/drouting/dr_time.c
index 5482df7e7c..879665a07d 100644
--- a/src/modules/drouting/dr_time.c
+++ b/src/modules/drouting/dr_time.c
@@ -214,6 +214,7 @@ ac_maxval_p ac_get_maxval(ac_tm_p _atp)
 	_amp = (ac_maxval_p)shm_malloc(sizeof(ac_maxval_t));
 	if(!_amp)
 		return NULL;
+	memset(_amp, 0, sizeof(ac_maxval_t));
 
 	/* the number of the days in the year */
 	_amp->yday = 365 + is_leap_year(_atp->t.tm_year + 1900);
@@ -269,6 +270,10 @@ ac_maxval_p ac_get_maxval(ac_tm_p _atp)
 				  + 1;
 #endif
 
+	if(_atp->mv!=NULL) {
+		shm_free(_atp->mv);
+	}
+
 	_atp->mv = _amp;
 	return _amp;
 }




More information about the sr-dev mailing list