]> granicus.if.org Git - php/commitdiff
-use of emalloc functions
authorMarcus Boerger <helly@php.net>
Tue, 5 Nov 2002 15:01:20 +0000 (15:01 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 5 Nov 2002 15:01:20 +0000 (15:01 +0000)
-info was not initialised fulle due to memset parameters
 now that the whole structure is initialised we can stop putting 0 in it.

ext/dba/dba.c

index b30e0b6bb24231dc7cb4e757b46e5d703eaf2cad..4705c26e3e600f22f2f5b67bc5ca83e7b7cf90f0 100644 (file)
@@ -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);