From: Tom Lane Date: Sun, 17 Sep 2017 15:35:27 +0000 (-0400) Subject: Fix bogus size calculation introduced by commit cc5f81366. X-Git-Tag: REL_11_BETA1~1579 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cad22075bc2ce9c1fbe61e8d3969d4dbdb5bc1f3;p=postgresql Fix bogus size calculation introduced by commit cc5f81366. The elements of RecordCacheArray are TupleDesc, not TupleDesc *. Those are actually the same size, so that this error is harmless, but it's still wrong --- and it might bite us someday, if TupleDesc ever became a struct, say. Per Coverity. --- diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index fd80c128cb..16c52c5a38 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -1386,7 +1386,7 @@ ensure_record_cache_typmod_slot_exists(int32 typmod) RecordCacheArray = (TupleDesc *) repalloc(RecordCacheArray, newlen * sizeof(TupleDesc)); memset(RecordCacheArray + RecordCacheArrayLen, 0, - (newlen - RecordCacheArrayLen) * sizeof(TupleDesc *)); + (newlen - RecordCacheArrayLen) * sizeof(TupleDesc)); RecordCacheArrayLen = newlen; } }