> > - stack_slabs[depot_index + 1] = *prealloc; > > + /* If this is the last depot slab, do not touch the next one. */ > > + if (depot_index + 1 < STACK_ALLOC_MAX_SLABS) > > + stack_slabs[depot_index + 1] = *prealloc; > > What prevents memory leak (caused by "*prealloc = NULL;") > when we hit depot_index + 1 >= STACK_ALLOC_MAX_SLABS condition? > Nice catch! We must return from this function instead of setting *prealloc to NULL. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg