Changeset 119 in svn


Ignore:
Timestamp:
2006-09-01T01:45:54+02:00 (9 years ago)
Author:
Xuefer
Message:

fix leak in xcache.test=1; XCACHE_VERSION/XCACHE_MODULES length off-by-one

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/mmap.c

    r83 r119  
    153153    volatile void *romem;
    154154    char tmpname[sizeof(TMP_PATH) - 1 + 100];
     155    const char *errstr = NULL;
    155156
    156157    CHECK(shm = calloc(1, sizeof(xc_shm_t)), "shm OOM");
     
    178179        /* do not create file in /dev */
    179180        if (strncmp(shm->name, "/dev", 4) == 0) {
     181            perror(shm->name);
     182            errstr = "Cannot open file set by xcache.mmap_path";
    180183            goto err;
    181184        }
     
    183186        shm->newfile = 1;
    184187        if (fd == -1) {
     188            perror(shm->name);
     189            errstr = "Cannot open or create file set by xcache.mmap_path";
    185190            goto err;
    186191        }
     
    197202
    198203    if (shm->ptr == XCACHE_MAP_FAILED) {
     204        perror(shm->name);
     205        errstr = "Failed creating file mappping";
    199206        shm->ptr = NULL;
    200207        goto err;
     
    268275        xc_shm_destroy(shm);
    269276    }
     277    if (errstr) {
     278        fprintf(stderr, "%s\n", errstr);
     279        zend_error(E_ERROR, "%s", errstr);
     280    }
    270281    return NULL;
    271282}
  • trunk/xcache.c

    r118 r119  
    939939    }
    940940    if (xc_test && stored_xce) {
     941        destroy_op_array(op_array TSRMLS_CC);
     942        efree(op_array);
    941943        goto restore;
    942944    }
     
    10651067    zend_register_long_constant(ZEND_STRS("XC_TYPE_PHP"), XC_TYPE_PHP, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
    10661068    zend_register_long_constant(ZEND_STRS("XC_TYPE_VAR"), XC_TYPE_VAR, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
    1067     zend_register_stringl_constant(ZEND_STRS("XCACHE_VERSION"), ZEND_STRS(XCACHE_VERSION), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
    1068     zend_register_stringl_constant(ZEND_STRS("XCACHE_MODULES"), ZEND_STRS(XCACHE_MODULES), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
     1069    zend_register_stringl_constant(ZEND_STRS("XCACHE_VERSION"), ZEND_STRL(XCACHE_VERSION), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
     1070    zend_register_stringl_constant(ZEND_STRS("XCACHE_MODULES"), ZEND_STRL(XCACHE_MODULES), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
    10691071    return 0;
    10701072}
Note: See TracChangeset for help on using the changeset viewer.