Module: sip-router
Branch: janakj/postgres
Commit: 1ba3b94ffcc88bed5926e251f1aaf534d51ff6e6
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1ba3b94…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Apr 25 15:24:06 2004 +0000
Fixed startup crash -- applied slightly modified patch from
Alexander Mayrhofer <axelm(a)nic.at>
---
modules/db_postgres/dbase.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/db_postgres/dbase.c b/modules/db_postgres/dbase.c
index 24b7e80..253fe8d 100644
--- a/modules/db_postgres/dbase.c
+++ b/modules/db_postgres/dbase.c
@@ -240,8 +240,10 @@ db_con_t *db_init(const char* _sqlurl)
/*
** this is the root memory for this database connection.
*/
- res = aug_alloc(sizeof(db_con_t) + sizeof(struct con_postgres), NULL);
- memset(res, 0, sizeof(db_con_t) + sizeof(struct con_postgres));
+ res = aug_alloc(sizeof(db_con_t), 0);
+ memset(res, 0, sizeof(db_con_t));
+ (struct con_postgres*)res->tail = aug_alloc(sizeof(struct con_postgres),
(char*)res);
+ memset((struct con_postgres*)res->tail, 0, sizeof(struct con_postgres));
if (connect_db(res, _sqlurl) < 0)
{