]> granicus.if.org Git - postgresql/commitdiff
Fix bogus size calculation introduced by commit cc5f81366.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Sep 2017 15:35:27 +0000 (11:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Sep 2017 15:35:27 +0000 (11:35 -0400)
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.

src/backend/utils/cache/typcache.c

index fd80c128cbe38f998f08158d95c3bb17b6484315..16c52c5a38af2c131ecc97c05930f5daf4a1c668 100644 (file)
@@ -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;
        }
 }