Module: sip-router
Branch: master
Commit: 63c724b42d4c4ff45eaa660508d6358f3e894d0a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=63c724b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sat Sep 18 11:58:21 2010 +0200
db_postgres: reset row_buf for each row
- DB1 interface was reusing local buffer to convert returned rows,
resulting in misusage of values from previous rows for null values
- reported by Jan Klepal
---
modules/db_postgres/km_res.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/km_res.c b/modules/db_postgres/km_res.c
index c4148ec..106ad22 100644
--- a/modules/db_postgres/km_res.c
+++ b/modules/db_postgres/km_res.c
@@ -220,7 +220,6 @@ int db_postgres_convert_rows(const db1_con_t* _h, db1_res_t* _r)
return -1;
}
LM_DBG("allocate for %d columns %d bytes in row buffer at %p\n",
RES_COL_N(_r), len, row_buf);
- memset(row_buf, 0, len);
if (db_allocate_rows(_r) < 0) {
LM_ERR("could not allocate rows\n");
@@ -230,6 +229,8 @@ int db_postgres_convert_rows(const db1_con_t* _h, db1_res_t* _r)
}
for(row = RES_LAST_ROW(_r); row < (RES_LAST_ROW(_r) + RES_ROW_N(_r)); row++) {
+ /* reset row buf content */
+ memset(row_buf, 0, len);
for(col = 0; col < RES_COL_N(_r); col++) {
/*
* The row data pointer returned by PQgetvalue points to storage