[sr-dev] git:master: ndb_redis: free _redisc_rpl_list.

Vicente Hernando vhernando at systemonenoc.com
Sun Jun 17 15:07:21 CEST 2012


Module: sip-router
Branch: master
Commit: d096e24b900856396332ebd61ae854fc044c8971
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d096e24b900856396332ebd61ae854fc044c8971

Author: Vicente Hernando <vhernando at systemonenoc.com>
Committer: Vicente Hernando <vhernando at systemonenoc.com>
Date:   Sun Jun 17 15:02:43 2012 +0200

ndb_redis: free _redisc_rpl_list.

- Free pending redis data to close ndb_redis module in a cleaner way.

---

 modules/ndb_redis/redis_client.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/modules/ndb_redis/redis_client.c b/modules/ndb_redis/redis_client.c
index 234bb3a..9066fda 100644
--- a/modules/ndb_redis/redis_client.c
+++ b/modules/ndb_redis/redis_client.c
@@ -107,8 +107,26 @@ err:
  */
 int redisc_destroy(void)
 {
+	redisc_reply_t *rpl, *next_rpl;
+
 	redisc_server_t *rsrv=NULL;
 	redisc_server_t *rsrv1=NULL;
+
+	rpl = _redisc_rpl_list;
+	while(rpl != NULL)
+	{
+		next_rpl = rpl->next;
+		if(rpl->rplRedis)
+			freeReplyObject(rpl->rplRedis);
+
+		if(rpl->rname.s != NULL)
+			pkg_free(rpl->rname.s);
+
+		pkg_free(rpl);
+		rpl = next_rpl;
+	}
+	_redisc_rpl_list = NULL;
+
 	if(_redisc_srv_list==NULL)
 		return -1;
 	rsrv=_redisc_srv_list;
@@ -121,6 +139,8 @@ int redisc_destroy(void)
 		free_params(rsrv1->attrs);
 		pkg_free(rsrv1);
 	}
+	_redisc_srv_list = NULL;
+
 	return 0;
 }
 




More information about the sr-dev mailing list