Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

Memory is not de-allocated in slabs.c/grow_slab_list #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Memory is not de-allocated in slabs.c/grow_slab_list

static int grow_slab_list (const unsigned int id) {
    slabclass_t *p = &slabclass[id];
    if (p->slabs == p->list_size) {

        size_t new_size =  (p->list_size != 0) ? p->list_size * 2 : 16;
        void *new_list = realloc(p->slab_list, new_size * sizeof(void *));
        if (new_list == 0) return 0;

        // Bug Here  old slab_list is not freed
        p->list_size = new_size;
        p->slab_list = new_list;
    }
    return 1;
}

Original issue reported on code.google.com by WFXiang08 on 28 Mar 2010 at 11:56

GoogleCodeExporter commented 9 years ago
Check the man page for realloc...

Original comment by trond.no...@gmail.com on 28 Mar 2010 at 4:24