From 78516c79059e9566cb573998497bd72b7be1a0dc Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 18 Feb 2006 17:11:06 +0000 Subject: - Fixed bug #36436 (DBA problem with Berkeley DB4). --- ext/dba/dba_db4.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ext/dba/dba_db4.c') diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index ddfdf341b1..994dd8bd67 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -139,9 +139,15 @@ DBA_FETCH_FUNC(db4) DB4_GKEY; memset(&gval, 0, sizeof(gval)); + if (info->flags & DBA_PERSISTENT) { + gval.flags |= DB_DBT_MALLOC; + } if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { if (newlen) *newlen = gval.size; new = estrndup(gval.data, gval.size); + if (info->flags & DBA_PERSISTENT) { + free(gval.data); + } } return new; } @@ -210,11 +216,23 @@ DBA_NEXTKEY_FUNC(db4) memset(&gkey, 0, sizeof(gkey)); memset(&gval, 0, sizeof(gval)); + if (info->flags & DBA_PERSISTENT) { + gkey.flags |= DB_DBT_MALLOC; + gval.flags |= DB_DBT_MALLOC; + } if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) { if (gkey.data) { nkey = estrndup(gkey.data, gkey.size); if (newlen) *newlen = gkey.size; } + if (info->flags & DBA_PERSISTENT) { + if (gkey.data) { + free(gkey.data); + } + if (gval.data) { + free(gval.data); + } + } } return nkey; -- cgit v1.2.1