aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-save.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 08:15:22 +0100
committereunhhu <[email protected]>2026-10-19 08:15:22 +0100
commit0896b3886295a21479268ccb78651adfff5e5e33 (patch)
tree11a2233ccc6b1fd6ffe2959c92ad13284914a063 /core/module-save.c
parent143b790388637a6063418aeb61c9988cc9c4c094 (diff)
downloadpure-0896b3886295a21479268ccb78651adfff5e5e33.tar.gz
pure-0896b3886295a21479268ccb78651adfff5e5e33.zip
A save's arrays for many states asked with || (clang's -Wbitwise-instead-of-logical stopped a clang build since 027's 4f-2, so a Mac's: the same frees either way, the second malloc not tried when the first fails); Pure builds and its unit tests pass with clang
Diffstat (limited to 'core/module-save.c')
-rw-r--r--core/module-save.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/module-save.c b/core/module-save.c
index 6e204d1..ff76d83 100644
--- a/core/module-save.c
+++ b/core/module-save.c
@@ -1134,7 +1134,7 @@ PureResult pure_save_commit(PureApp *app, const PureValue *values) {
/* A draft a state at most, and three more: on the stack for a few states (027's 4f-2). */
PureDraft *few_drafts[FEW_STATES + 3], **drafts = few_drafts;
uint32_t few_states[FEW_STATES + 3], *states = few_states;
- if (m->states > FEW_STATES && (!(drafts = malloc((m->states + 3) * sizeof(*drafts))) |
+ if (m->states > FEW_STATES && (!(drafts = malloc((m->states + 3) * sizeof(*drafts))) ||
!(states = malloc((m->states + 3) * sizeof(*states))))) {
if (drafts != few_drafts) free(drafts);
if (states != few_states) free(states);