From: Marcus Boerger Date: Tue, 5 Nov 2002 15:01:20 +0000 (+0000) Subject: -use of emalloc functions X-Git-Tag: php-4.3.0RC1~262 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77858f7fcd977cab007f38b97b4ccf30db915f29;p=php -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. --- diff --git a/ext/dba/dba.c b/ext/dba/dba.c index b30e0b6bb2..4705c26e3e 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -197,8 +197,8 @@ static int le_pdb; 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 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) 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);