mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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.
This commit is contained in:
@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user