File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2271,7 +2271,8 @@ rum_ts_join_pos(PG_FUNCTION_ARGS)
2271
2271
count2 = count_pos (in2 , VARSIZE_ANY_EXHDR (addInfo2 )),
2272
2272
countRes = 0 ;
2273
2273
int i1 = 0 , i2 = 0 ;
2274
- Size size ;
2274
+ Size size ,
2275
+ size_compressed ;
2275
2276
WordEntryPos pos1 = 0 ,
2276
2277
pos2 = 0 ,
2277
2278
* pos ;
@@ -2343,10 +2344,11 @@ rum_ts_join_pos(PG_FUNCTION_ARGS)
2343
2344
* uncompressed positions. So allocate memory with a margin.
2344
2345
*/
2345
2346
size = VARHDRSZ + 2 * sizeof (WordEntryPos ) * countRes ;
2346
- result = palloc (size );
2347
+ result = palloc0 (size );
2347
2348
2348
- size = compress_pos (result -> vl_dat , pos , countRes ) + VARHDRSZ ;
2349
- SET_VARSIZE (result , size );
2349
+ size_compressed = compress_pos (result -> vl_dat , pos , countRes ) + VARHDRSZ ;
2350
+ Assert (size >= size_compressed );
2351
+ SET_VARSIZE (result , size_compressed );
2350
2352
2351
2353
PG_RETURN_BYTEA_P (result );
2352
2354
}
You can’t perform that action at this time.
0 commit comments