[sr-dev] git:master: srdb1: fix memory leak in db-id
Torrey Searle
tsearle at gmail.com
Mon Jun 2 19:54:06 CEST 2014
Module: sip-router
Branch: master
Commit: 69de17d3bb1d032f9a41752362194d718336e20d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=69de17d3bb1d032f9a41752362194d718336e20d
Author: Torrey Searle <tsearle at gmail.com>
Committer: Torrey Searle <tsearle at gmail.com>
Date: Mon Jun 2 19:51:19 2014 +0200
srdb1: fix memory leak in db-id
- When getting an existing connection from the pool, free the newly
created db-id as the pool connection already has a reference to the
existing one. Fixes FS#436
---
lib/srdb1/db.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/srdb1/db.c b/lib/srdb1/db.c
index 3eea708..f717464 100644
--- a/lib/srdb1/db.c
+++ b/lib/srdb1/db.c
@@ -325,6 +325,8 @@ db1_con_t* db_do_init2(const str* url, void* (*new_connection)(), db_pooling_t p
pool_insert((struct pool_con*)con);
} else {
LM_DBG("connection %p found in pool\n", id);
+ free_db_id(id); // free the new id, as we use the pool instead
+ id = 0;
}
res->tail = (unsigned long)con;
More information about the sr-dev
mailing list