mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 14:41:42 +03:00
Fix wrong loop variable for array index in sz_boot_pind2sz_tab
The sentinel fill loop used sz_pind2sz_tab[pind] (constant) instead of sz_pind2sz_tab[i] (loop variable), writing only to the first entry repeatedly and leaving subsequent entries uninitialized.
This commit is contained in:
parent
675ab079e7
commit
234404d324
1 changed files with 2 additions and 2 deletions
4
src/sz.c
4
src/sz.c
|
|
@ -65,7 +65,7 @@ sz_boot_pind2sz_tab(const sc_data_t *sc_data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = pind; i <= (int)SC_NPSIZES; i++) {
|
for (int i = pind; i <= (int)SC_NPSIZES; i++) {
|
||||||
sz_pind2sz_tab[pind] = sc_data->large_maxclass + PAGE;
|
sz_pind2sz_tab[i] = sc_data->large_maxclass + PAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ sz_boot_size2index_tab(const sc_data_t *sc_data) {
|
||||||
size_t dst_max = (SC_LOOKUP_MAXCLASS >> SC_LG_TINY_MIN) + 1;
|
size_t dst_max = (SC_LOOKUP_MAXCLASS >> SC_LG_TINY_MIN) + 1;
|
||||||
size_t dst_ind = 0;
|
size_t dst_ind = 0;
|
||||||
for (unsigned sc_ind = 0; sc_ind < SC_NSIZES && dst_ind < dst_max;
|
for (unsigned sc_ind = 0; sc_ind < SC_NSIZES && dst_ind < dst_max;
|
||||||
sc_ind++) {
|
sc_ind++) {
|
||||||
const sc_t *sc = &sc_data->sc[sc_ind];
|
const sc_t *sc = &sc_data->sc[sc_ind];
|
||||||
size_t sz = (ZU(1) << sc->lg_base)
|
size_t sz = (ZU(1) << sc->lg_base)
|
||||||
+ (ZU(sc->ndelta) << sc->lg_delta);
|
+ (ZU(sc->ndelta) << sc->lg_delta);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue