Initialize unused ExprEvalStep fields.
ExecPushExprSlots didn't initialize ExprEvalStep's resvalue/resnull steps as it didn't use them. That caused wrong valgrind warnings for an upcoming patch, so zero-intialize. Also zero-initialize all scratch ExprEvalStep's allocated on the stack, to avoid issues with similar future omissions of non-critial data.
This commit is contained in:
parent
1e1e599d66
commit
fc96c69425
@ -118,7 +118,7 @@ ExprState *
|
||||
ExecInitExpr(Expr *node, PlanState *parent)
|
||||
{
|
||||
ExprState *state;
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
|
||||
/* Special case: NULL expression produces a NULL ExprState pointer */
|
||||
if (node == NULL)
|
||||
@ -155,7 +155,7 @@ ExprState *
|
||||
ExecInitExprWithParams(Expr *node, ParamListInfo ext_params)
|
||||
{
|
||||
ExprState *state;
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
|
||||
/* Special case: NULL expression produces a NULL ExprState pointer */
|
||||
if (node == NULL)
|
||||
@ -204,7 +204,7 @@ ExprState *
|
||||
ExecInitQual(List *qual, PlanState *parent)
|
||||
{
|
||||
ExprState *state;
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
List *adjust_jumps = NIL;
|
||||
ListCell *lc;
|
||||
|
||||
@ -353,7 +353,7 @@ ExecBuildProjectionInfo(List *targetList,
|
||||
{
|
||||
ProjectionInfo *projInfo = makeNode(ProjectionInfo);
|
||||
ExprState *state;
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
ListCell *lc;
|
||||
|
||||
projInfo->pi_exprContext = econtext;
|
||||
@ -638,7 +638,7 @@ static void
|
||||
ExecInitExprRec(Expr *node, ExprState *state,
|
||||
Datum *resv, bool *resnull)
|
||||
{
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
|
||||
/* Guard against stack overflow due to overly complex expressions */
|
||||
check_stack_depth();
|
||||
@ -2273,7 +2273,10 @@ ExecInitExprSlots(ExprState *state, Node *node)
|
||||
static void
|
||||
ExecPushExprSlots(ExprState *state, LastAttnumInfo *info)
|
||||
{
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
|
||||
scratch.resvalue = NULL;
|
||||
scratch.resnull = NULL;
|
||||
|
||||
/* Emit steps as needed */
|
||||
if (info->last_inner > 0)
|
||||
@ -2659,7 +2662,7 @@ static void
|
||||
ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
|
||||
ExprState *state, Datum *resv, bool *resnull)
|
||||
{
|
||||
ExprEvalStep scratch2;
|
||||
ExprEvalStep scratch2 = {0};
|
||||
DomainConstraintRef *constraint_ref;
|
||||
Datum *domainval = NULL;
|
||||
bool *domainnull = NULL;
|
||||
@ -2811,7 +2814,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
|
||||
{
|
||||
ExprState *state = makeNode(ExprState);
|
||||
PlanState *parent = &aggstate->ss.ps;
|
||||
ExprEvalStep scratch;
|
||||
ExprEvalStep scratch = {0};
|
||||
int transno = 0;
|
||||
int setoff = 0;
|
||||
bool isCombine = DO_AGGSPLIT_COMBINE(aggstate->aggsplit);
|
||||
|
Loading…
x
Reference in New Issue
Block a user