Skip to content

Commit 580f6cb

Browse files
author
Alexander Korotkov
committed
Fix some clang analyzer complaints.
1 parent 0dc0ef4 commit 580f6cb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: jsonb_gin_ops.c

+9
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;

Diff for: jsquery_extract.c

+1
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)