Browse Source

modules/ims_usrloc_pcscf: fixed free of service_routes from pcontact in P-CSCF

jaybeepee 10 years ago
parent
commit
ffc4852124
2 changed files with 6 additions and 6 deletions
  1. 3 3
      modules/ims_usrloc_pcscf/pcontact.c
  2. 3 3
      modules/ims_usrloc_pcscf/udomain.c

+ 3 - 3
modules/ims_usrloc_pcscf/pcontact.c

@@ -270,10 +270,10 @@ void free_pcontact(pcontact_t* _c) {
 		for (i = 0; i < _c->num_service_routes; i++) {
 			if (_c->service_routes[i].s)
 				shm_free(_c->service_routes[i].s);
-			shm_free(_c->service_routes);
-			_c->service_routes = 0;
-			_c->num_service_routes = 0;
 		}
+		shm_free(_c->service_routes);
+		_c->service_routes = 0;
+		_c->num_service_routes = 0;
 	}
 
 	if (_c->rx_session_id.len > 0 && _c->rx_session_id.s)

+ 3 - 3
modules/ims_usrloc_pcscf/udomain.c

@@ -354,10 +354,10 @@ int update_pcontact(struct udomain* _d, struct pcontact_info* _ci, struct pconta
 			for (i=0; i<_c->num_service_routes; i++) {
 				if (_c->service_routes[i].s)
 					shm_free(_c->service_routes[i].s);
-				shm_free(_c->service_routes);
-				_c->service_routes=0;
-				_c->num_service_routes=0;
 			}
+			shm_free(_c->service_routes);
+			_c->service_routes=0;
+			_c->num_service_routes=0;
 		}
 		//now add the new service routes
 		if (_ci->num_service_routes > 0) {