diff options
| author | Alvaro Herrera | 2017-03-27 17:52:19 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2017-03-27 17:52:19 +0000 |
| commit | 6462238f0d7b7c15eb3f54c2108573cee8fb24ba (patch) | |
| tree | fdc9fc118af673cfccfa0a67ac43c03149f4fd9e /src/include/statistics | |
| parent | 6e31c3e13514be4404f716f152ac4c434adad03a (diff) | |
Fix uninitialized memory propagation mistakes
Valgrind complains that some uninitialized bytes are being passed around
by the extended statistics code since commit 7b504eb282ca2f, as reported
by Andres Freund. Silence it.
Tomas Vondra submitted a patch which he verified to fix the complaints
in his machine; however I messed with it a bit before pushing, so any
remaining problems are likely my (Álvaro's) fault.
Author: Tomas Vondra
Discussion: https://postgr.es/m/20170325211031.4xxoptigqxm2emn2@alap3.anarazel.de
Diffstat (limited to 'src/include/statistics')
| -rw-r--r-- | src/include/statistics/statistics.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/statistics/statistics.h b/src/include/statistics/statistics.h index a15e39e1a30..91645bff4b0 100644 --- a/src/include/statistics/statistics.h +++ b/src/include/statistics/statistics.h @@ -27,6 +27,9 @@ typedef struct MVNDistinctItem double ndistinct; /* ndistinct value for this combination */ Bitmapset *attrs; /* attr numbers of items */ } MVNDistinctItem; +/* size of the struct, excluding attribute list */ +#define SizeOfMVNDistinctItem \ + (offsetof(MVNDistinctItem, ndistinct) + sizeof(double)) /* A MVNDistinct object, comprising all possible combinations of columns */ typedef struct MVNDistinct @@ -37,6 +40,10 @@ typedef struct MVNDistinct MVNDistinctItem items[FLEXIBLE_ARRAY_MEMBER]; } MVNDistinct; +/* size of the struct excluding the items array */ +#define SizeOfMVNDistinct (offsetof(MVNDistinct, nitems) + sizeof(uint32)) + + extern MVNDistinct *statext_ndistinct_load(Oid mvoid); extern void BuildRelationExtStatistics(Relation onerel, double totalrows, |
