diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2014-12-16 10:32:06 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2014-12-16 10:32:06 -0500 |
commit | c8315930e6a34b616d9840985c85eb0d856dd2df (patch) | |
tree | 55cccd7d95a0dd1f2bc79ac79b1c8d648f2433d7 /src/backend/utils/adt/jsonfuncs.c | |
parent | 4d65e16a6ff609701a8780d3cddbae02c6e20926 (diff) | |
download | postgresql-c8315930e6a34b616d9840985c85eb0d856dd2df.tar.gz postgresql-c8315930e6a34b616d9840985c85eb0d856dd2df.zip |
Fix some jsonb issues found by Coverity in recent commits.
Mostly these issues concern the non-use of function results. These
have been changed to use (void) pushJsonbValue(...) instead of assigning
the result to a variable that gets overwritten before it is used.
There is a larger issue that we should possibly examine the API for
pushJsonbValue(), so that instead of returning a value it modifies a
state argument. The current idiom is rather clumsy. However, changing
that requires quite a bit more work, so this change should do for the
moment.
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 0a85ee81091..93cbe274f07 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -3182,7 +3182,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS) continue; /* otherwise, do a delayed push of the key */ - res = pushJsonbValue(&parseState, WJB_KEY, &k); + (void) pushJsonbValue(&parseState, WJB_KEY, &k); } if (type == WJB_VALUE || type == WJB_ELEM) @@ -3191,5 +3191,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS) res = pushJsonbValue(&parseState, type, NULL); } + Assert(res != NULL); + PG_RETURN_POINTER(JsonbValueToJsonb(res)); } |