Skip to content

Commit e40b2f7

Browse files
committed
Fix abort_conf processing.
When abort_conf is set, make sure we always error out at the end of the options processing loop.
1 parent 0fadf4a commit e40b2f7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/jemalloc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,8 @@ malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v,
849849
size_t vlen) {
850850
malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k,
851851
(int)vlen, v);
852+
/* If abort_conf is set, error out after processing all options. */
852853
had_conf_error = true;
853-
if (opt_abort_conf) {
854-
malloc_abort_invalid_conf();
855-
}
856854
}
857855

858856
static void
@@ -1052,9 +1050,6 @@ malloc_conf_init(void) {
10521050

10531051
CONF_HANDLE_BOOL(opt_abort, "abort")
10541052
CONF_HANDLE_BOOL(opt_abort_conf, "abort_conf")
1055-
if (opt_abort_conf && had_conf_error) {
1056-
malloc_abort_invalid_conf();
1057-
}
10581053
if (strncmp("metadata_thp", k, klen) == 0) {
10591054
int i;
10601055
bool match = false;
@@ -1243,6 +1238,9 @@ malloc_conf_init(void) {
12431238
#undef CONF_HANDLE_SSIZE_T
12441239
#undef CONF_HANDLE_CHAR_P
12451240
}
1241+
if (opt_abort_conf && had_conf_error) {
1242+
malloc_abort_invalid_conf();
1243+
}
12461244
}
12471245
atomic_store_b(&log_init_done, true, ATOMIC_RELEASE);
12481246
}

0 commit comments

Comments
 (0)