forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit078b2ed
committed
Fix two ancient memory-leak bugs in relcache.c.
RelationCacheInsert() ignored the possibility that hash_search(HASH_ENTER)might find a hashtable entry already present for the same OID. However,that can in fact occur during recursive relcache load scenarios. When itdid happen, we overwrote the pointer to the pre-existing Relation, causinga session-lifespan leakage of that entire structure. As far as is known,the pre-existing Relation would always have reference count zero by thetime we arrive back at the outer insertion, so add code that deletes thepre-existing Relation if so. If by some chance its refcount is positive,elog a WARNING and allow the pre-existing Relation to be leaked as before.Also, AttrDefaultFetch() was sloppy about leaking the cstring form of thepg_attrdef.adbin value it's copying into the relcache structure. This isonly a query-lifespan leakage, and normally not very significant, but itadds up during CLOBBER_CACHE testing.These bugs are of very ancient vintage, but I'll refrain from back-patchingsince there's no evidence that these leaks amount to anything in ordinaryusage.1 parent44cd47c commit078b2ed
1 file changed
+48
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
181 | 181 | | |
182 | | - | |
183 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
187 | 199 | | |
188 | 200 | | |
189 | | - | |
190 | | - | |
191 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
192 | 204 | | |
193 | 205 | | |
194 | 206 | | |
| |||
197 | 209 | | |
198 | 210 | | |
199 | 211 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
203 | 215 | | |
204 | | - | |
205 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
206 | 219 | | |
207 | 220 | | |
208 | 221 | | |
| |||
982 | 995 | | |
983 | 996 | | |
984 | 997 | | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
985 | 1007 | | |
986 | 1008 | | |
987 | | - | |
| 1009 | + | |
988 | 1010 | | |
989 | 1011 | | |
990 | 1012 | | |
| |||
1599 | 1621 | | |
1600 | 1622 | | |
1601 | 1623 | | |
1602 | | - | |
| 1624 | + | |
1603 | 1625 | | |
1604 | 1626 | | |
1605 | 1627 | | |
| |||
2841 | 2863 | | |
2842 | 2864 | | |
2843 | 2865 | | |
2844 | | - | |
| 2866 | + | |
2845 | 2867 | | |
2846 | 2868 | | |
2847 | 2869 | | |
| |||
3489 | 3511 | | |
3490 | 3512 | | |
3491 | 3513 | | |
3492 | | - | |
3493 | | - | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
3494 | 3521 | | |
3495 | 3522 | | |
3496 | 3523 | | |
| |||
4717 | 4744 | | |
4718 | 4745 | | |
4719 | 4746 | | |
4720 | | - | |
| 4747 | + | |
4721 | 4748 | | |
4722 | 4749 | | |
4723 | 4750 | | |
| |||
0 commit comments
Comments
(0)