aboutsummaryrefslogtreecommitdiff
path: root/src/common/jsonapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/jsonapi.c')
-rw-r--r--src/common/jsonapi.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/common/jsonapi.c b/src/common/jsonapi.c
index 6892a4be4e0..45838d8a184 100644
--- a/src/common/jsonapi.c
+++ b/src/common/jsonapi.c
@@ -544,19 +544,28 @@ inc_lex_level(JsonLexContext *lex)
new_prediction = REALLOC(lex->pstack->prediction,
new_stack_size * JS_MAX_PROD_LEN);
+#ifdef JSONAPI_USE_PQEXPBUFFER
+ if (!new_prediction)
+ return false;
+#endif
+ lex->pstack->prediction = new_prediction;
+
new_fnames = REALLOC(lex->pstack->fnames,
new_stack_size * sizeof(char *));
- new_fnull = REALLOC(lex->pstack->fnull, new_stack_size * sizeof(bool));
+#ifdef JSONAPI_USE_PQEXPBUFFER
+ if (!new_fnames)
+ return false;
+#endif
+ lex->pstack->fnames = new_fnames;
+ new_fnull = REALLOC(lex->pstack->fnull, new_stack_size * sizeof(bool));
#ifdef JSONAPI_USE_PQEXPBUFFER
- if (!new_prediction || !new_fnames || !new_fnull)
+ if (!new_fnull)
return false;
#endif
+ lex->pstack->fnull = new_fnull;
lex->pstack->stack_size = new_stack_size;
- lex->pstack->prediction = new_prediction;
- lex->pstack->fnames = new_fnames;
- lex->pstack->fnull = new_fnull;
}
lex->lex_level += 1;