[sr-dev] git:master:d73d56b4: modules/ims_charging: removed unused impu_data parcel (memory leak)

jaybeepee jason.penton at gmail.com
Tue Nov 10 09:38:09 CET 2015


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

Author: jaybeepee <jason.penton at gmail.com>
Committer: jaybeepee <jason.penton at gmail.com>
Date: 2015-11-10T10:36:16+02:00

modules/ims_charging: removed unused impu_data parcel (memory leak)

---

Modified: modules/ims_charging/mod.c
Modified: modules/ims_charging/ro_session_hash.h

---

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

---

diff --git a/modules/ims_charging/mod.c b/modules/ims_charging/mod.c
index 48f050b..d2f371d 100644
--- a/modules/ims_charging/mod.c
+++ b/modules/ims_charging/mod.c
@@ -378,10 +378,7 @@ static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction,
 	tm_cell_t *t;
 	unsigned int tindex = 0,
 				 tlabel = 0;
-	struct impu_data *impu_data;
-	char *p;
 	struct dlg_cell* dlg;
-	unsigned int len;
 	struct ro_session *ro_session = 0;
 	int free_contact = 0;
 	
@@ -457,34 +454,6 @@ static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction,
 	}
 	
 	LM_DBG("IMPU data to pass to usrloc:  contact <%.*s> identity <%.*s>\n", contact.len, contact.s, identity.len, identity.s);
-	
-	//create impu_data_parcel
-	len = identity.len + contact.len +  sizeof (struct impu_data);
-	impu_data = (struct impu_data*) shm_malloc(len);
-	if (!impu_data) {
-	    LM_ERR("Unable to allocate memory for impu_data, trying to send CCR\n");
-	    ret = RO_RETURN_ERROR;
-	    goto done;
-	}
-	memset(impu_data, 0, len);
-	
-	p = (char*) (impu_data + 1);
-	impu_data->identity.s = p;
-	impu_data->identity.len = identity.len;
-	memcpy(p, identity.s, identity.len);
-	p += identity.len;
-
-	impu_data->contact.s = p;
-	impu_data->contact.len = contact.len;
-	memcpy(p, contact.s, contact.len);
-	p += contact.len;
-	
-	if (p != (((char*) impu_data) + len)) {
-	    LM_ERR("buffer overflow creating impu data, trying to send CCR\n");
-	    shm_free(impu_data);
-	    ret = RO_RETURN_ERROR;
-	    goto done;
-	}
 
 send_ccr:
 
diff --git a/modules/ims_charging/ro_session_hash.h b/modules/ims_charging/ro_session_hash.h
index dcd79e5..7257721 100644
--- a/modules/ims_charging/ro_session_hash.h
+++ b/modules/ims_charging/ro_session_hash.h
@@ -173,12 +173,6 @@ static inline void unlink_unsafe_ro_session(struct ro_session_entry *ro_session_
 int init_ro_session_table(unsigned int size);
 
 /*!
- * \brief Destroy a ro_session and free memory
- * \param ro_session destroyed Ro Session
- */
-inline void destroy_ro_session(struct ro_session *ro_session);
-
-/*!
  * \brief Destroy the ro_session dialog table
  */
 void destroy_ro_session_table(void);




More information about the sr-dev mailing list