helly Tue Nov 5 10:01:21 2002 EDT
Modified files:
/php4/ext/dba dba.c
Log:
-use of emalloc functions
-info was not initialised fulle due to memset parameters
now that the whole structure is initialised we can stop putting 0 in it.
Index: php4/ext/dba/dba.c
diff -u php4/ext/dba/dba.c:1.51 php4/ext/dba/dba.c:1.52
--- php4/ext/dba/dba.c:1.51 Tue Nov 5 09:46:35 2002
+++ php4/ext/dba/dba.c Tue Nov 5 10:01:20 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba.c,v 1.51 2002/11/05 14:46:35 helly Exp $ */
+/* $Id: dba.c,v 1.52 2002/11/05 15:01:20 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -197,8 +197,8 @@
static void dba_close(dba_info *info TSRMLS_DC)
{
if(info->hnd) info->hnd->close(info TSRMLS_CC);
- if(info->path) free(info->path);
- free(info);
+ if(info->path) efree(info->path);
+ efree(info);
}
/* }}} */
@@ -365,13 +365,12 @@
RETURN_FALSE;
}
- info = malloc(sizeof(*info));
- memset(info, 0, sizeof(info));
- info->path = strdup(Z_STRVAL_PP(args[0]));
+ info = ecalloc(sizeof(dba_info), 1);
+ info->path = estrdup(Z_STRVAL_PP(args[0]));
info->mode = modenr;
info->argc = ac - 3;
info->argv = args + 3;
- info->hnd = NULL;
+ /* info->hnd is NULL here */
if (hptr->open(info, &error TSRMLS_CC) != SUCCESS) {
dba_close(info TSRMLS_CC);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php