Module: sip-router Branch: master Commit: 537dd99065f82f674fba8a5132b9cafb8735f6c9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=537dd990...
Author: Henning Westerholt henning.westerholt@1und1.de Committer: Henning Westerholt henning.westerholt@1und1.de Date: Mon Jul 26 19:01:06 2010 +0200
Revert "db_postgres(old API) FS#77: fix BLOBs with postgres"
This reverts commit 2e56720769913c55cacc83fe3a31f44f072e7590.
---
modules/db_postgres/km_val.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/modules/db_postgres/km_val.c b/modules/db_postgres/km_val.c index 9faa5b5..cb3fe9f 100644 --- a/modules/db_postgres/km_val.c +++ b/modules/db_postgres/km_val.c @@ -72,18 +72,16 @@ int db_postgres_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const LM_ERR("PQunescapeBytea failed\n"); return -7; } - VAL_BLOB(_v).s = pkg_malloc(VAL_BLOB(_v).len + 1); + VAL_BLOB(_v).s = pkg_malloc(VAL_BLOB(_v).len); if (VAL_BLOB(_v).s == NULL) { LM_ERR("no private memory left\n"); PQfreemem(tmp_s); return -8; } - LM_DBG("allocate %d bytes memory for BLOB at %p", VAL_BLOB(_v).len + 1, VAL_BLOB(_v).s); + LM_DBG("allocate %d bytes memory for BLOB at %p", VAL_BLOB(_v).len, VAL_BLOB(_v).s); memcpy(VAL_BLOB(_v).s, tmp_s, VAL_BLOB(_v).len); PQfreemem(tmp_s);
- VAL_BLOB(_v).s[VAL_BLOB(_v).len] = '\0'; - VAL_BLOB(_v).len++; VAL_TYPE(_v) = DB1_BLOB; VAL_FREE(_v) = 1;