Module: sip-router Branch: janakj/postgres Commit: d25ca3c1ae11a6e65120441cb86ffdec7185f328 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d25ca3c1...
Author: Henning Westerholt henning.westerholt@1und1.de Committer: Henning Westerholt henning.westerholt@1und1.de Date: Wed Jan 7 13:32:44 2009 +0000
- db_postgres_convert_rows needs to free the row_buf on all error conditions - db_postgres_convert_rows now free all rows when a processing error happens - as now all memory is freed in error condition in the later steps, we can change the logic db_postgres_store_result to only free the result in this case, this fixes one crash in a out of memory error condition - sync error msg with mysql, remove unnecessary connection pointer output
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5428 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_postgres/km_dbase.c | 4 ++-- modules/db_postgres/km_res.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/db_postgres/km_dbase.c b/modules/db_postgres/km_dbase.c index 0a5572d..b02a5ad 100644 --- a/modules/db_postgres/km_dbase.c +++ b/modules/db_postgres/km_dbase.c @@ -413,8 +413,8 @@ int db_postgres_store_result(const db_con_t* _con, db_res_t** _r) /* Successful completion of a command returning data * (such as a SELECT or SHOW). */ if (db_postgres_convert_result(_con, *_r) < 0) { - LM_ERR("%p Error returned from convert_result()\n", _con); - db_free_result(*_r); + LM_ERR("error while converting result\n"); + pkg_free(*_r); *_r = 0; rc = -4; break; diff --git a/modules/db_postgres/km_res.c b/modules/db_postgres/km_res.c index 431b81f..548e535 100644 --- a/modules/db_postgres/km_res.c +++ b/modules/db_postgres/km_res.c @@ -224,6 +224,8 @@ int db_postgres_convert_rows(const db_con_t* _h, db_res_t* _r)
if (db_allocate_rows(_r) < 0) { LM_ERR("could not allocate rows\n"); + LM_DBG("freeing row buffer at %p\n", row_buf); + pkg_free(row_buf); return -2; }
@@ -260,6 +262,7 @@ int db_postgres_convert_rows(const db_con_t* _h, db_res_t* _r) } LM_DBG("freeing row buffer at %p\n", row_buf); pkg_free(row_buf); + db_free_rows(_r); return -4; /* * The following housekeeping may not be technically required, but it