Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7911e78

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 f7e7d6f commit 7911e78

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
@@ -1141,7 +1141,7 @@ CachedPlan *
11411141
GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
11421142
bool useResOwner)
11431143
{
1144-
CachedPlan *plan;
1144+
CachedPlan *plan = NULL;
11451145
List *qlist;
11461146
bool customplan;
11471147

@@ -1223,6 +1223,8 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
12231223
}
12241224
}
12251225

1226+
Assert(plan != NULL);
1227+
12261228
/* Flag the plan as in use by caller */
12271229
if (useResOwner)
12281230
ResourceOwnerEnlargePlanCacheRefs(CurrentResourceOwner);

0 commit comments

Comments
 (0)