Changeset 119 for trunk/mmap.c


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

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

File:
1 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} 
Note: See TracChangeset for help on using the changeset viewer.