[SR-Dev] git:janakj/flatstore: - fixed memory leak in flat_reopen_connection, reported by

Jan Janak jan at iptel.org
Sun Feb 15 18:56:45 CET 2009


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

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Tue May 31 12:59:30 2005 +0000

- fixed memory leak in flat_reopen_connection, reported by
  Bayan William Towfiq <william at telepacket.com>

---

 modules/db_flatstore/flat_con.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/db_flatstore/flat_con.c b/modules/db_flatstore/flat_con.c
index d691c22..e148429 100644
--- a/modules/db_flatstore/flat_con.c
+++ b/modules/db_flatstore/flat_con.c
@@ -163,10 +163,17 @@ int flat_reopen_connection(struct flat_con* con)
 
 	if (con->file) {
 		fclose(con->file);
+		con->file = 0;
 
 		fn = get_name(con->id);
+		if (fn == 0) {
+			LOG(L_ERR, "flat_reopen_connection: get_name() failed\n");
+		        return -1;
+		}
 
 		con->file = fopen(fn, "a");
+		pkg_free(fn);
+
 		if (!con->file) {
 			LOG(L_ERR, "flat_reopen_connection: Invalid parameter value\n");
 			return -1;




More information about the sr-dev mailing list