Skip to content

Commit 0c5bb5c

Browse files
author
Alexander Korotkov
committed
Fix some clang analyzer complaints.
1 parent 6f1efc3 commit 0c5bb5c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

jsonb_gin_ops.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ gin_extract_jsonb_value_path_internal(Jsonb *jb, int32 *nentries, uint32 **bloom
691691
stack->parent = tmp;
692692
break;
693693
case WJB_KEY:
694+
if (!stack) /* should never happen */
695+
elog(ERROR, "error jsonb iteration");
694696
stack->hash = 0;
695697
JsonbHashScalarValue(&v, &stack->hash);
696698
break;
@@ -709,6 +711,8 @@ gin_extract_jsonb_value_path_internal(Jsonb *jb, int32 *nentries, uint32 **bloom
709711
break;
710712
case WJB_END_OBJECT:
711713
/* Pop the stack */
714+
if (!stack) /* should never happen */
715+
elog(ERROR, "error jsonb iteration");
712716
tmp = stack->parent;
713717
pfree(stack);
714718
stack = tmp;
@@ -1109,6 +1113,9 @@ gin_extract_jsonb_path_value_internal(Jsonb *jb, int32 *nentries)
11091113
entries = (Datum *) repalloc(entries, sizeof(Datum) * total);
11101114
}
11111115

1116+
if (!stack) /* should never happen */
1117+
elog(ERROR, "error jsonb iteration");
1118+
11121119
switch (r)
11131120
{
11141121
case WJB_BEGIN_ARRAY:
@@ -1131,6 +1138,8 @@ gin_extract_jsonb_path_value_internal(Jsonb *jb, int32 *nentries)
11311138
break;
11321139
case WJB_KEY:
11331140
/* Initialize hash from parent */
1141+
if (!stack->parent) /* should never happen */
1142+
elog(ERROR, "error jsonb iteration");
11341143
stack->hash = stack->parent->hash;
11351144
JsonbHashScalarValue(&v, &stack->hash);
11361145
break;

jsquery_extract.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ recursiveExtract(JsQueryItem *jsq, bool not, bool indirect, PathItem *path)
4848
ExtractedNodeType type;
4949
JsQueryItem elem, e;
5050

51+
e.hint = false;
5152
check_stack_depth();
5253

5354
switch(jsq->type)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy