helly Sat Feb 18 16:52:30 2006 UTC
Modified files:
/php-src/ext/dba dba_db4.c
Log:
- Initiai fix to Bug #36436 DBA problem with Berkeley DB4
http://cvs.php.net/viewcvs.cgi/php-src/ext/dba/dba_db4.c?r1=1.17&r2=1.18&diff_format=u
Index: php-src/ext/dba/dba_db4.c
diff -u php-src/ext/dba/dba_db4.c:1.17 php-src/ext/dba/dba_db4.c:1.18
--- php-src/ext/dba/dba_db4.c:1.17 Sun Jan 1 13:09:49 2006
+++ php-src/ext/dba/dba_db4.c Sat Feb 18 16:52:30 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db4.c,v 1.17 2006/01/01 13:09:49 sniper Exp $ */
+/* $Id: dba_db4.c,v 1.18 2006/02/18 16:52:30 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -139,9 +139,15 @@
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 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php