Skip to content

Commit 6b4a176

Browse files
committed
Silence compiler warnings
In GetCachedPlan(), initialize 'plan' to silence a compiler warning, but also add an Assert() to make sure we don't ever actually fall through with 'plan' still being set to NULL, since we are about to dereference it. Back-patch back to 9.2. Author: Stephen Frost Discussion: https://postgr.es/m/20161129152102.GR13284%40tamriel.snowman.net
1 parent 3f94796 commit 6b4a176

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/utils/cache/plancache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ CachedPlan *
10931093
GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
10941094
bool useResOwner)
10951095
{
1096-
CachedPlan *plan;
1096+
CachedPlan *plan = NULL;
10971097
List *qlist;
10981098
bool customplan;
10991099

@@ -1175,6 +1175,8 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
11751175
}
11761176
}
11771177

1178+
Assert(plan != NULL);
1179+
11781180
/* Flag the plan as in use by caller */
11791181
if (useResOwner)
11801182
ResourceOwnerEnlargePlanCacheRefs(CurrentResourceOwner);

0 commit comments

Comments
 (0)