Skip to content

Commit 97969a6

Browse files
author
Nikita Glukhov
committed
Fix PG_FREE_IF_COPY() macro for expanded objects
1 parent 5f4e1b2 commit 97969a6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/include/fmgr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena * datum);
226226
*/
227227
#define PG_FREE_IF_COPY(ptr,n) \
228228
do { \
229-
if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
229+
if ((Pointer) (ptr) != PG_GETARG_POINTER(n) && \
230+
(!VARATT_IS_EXTERNAL_EXPANDED(PG_GETARG_POINTER(n)) || \
231+
(Pointer) DatumGetEOHP(PG_GETARG_DATUM(n)) != (Pointer)(ptr))) \
230232
pfree(ptr); \
231233
} while (0)
232234

0 commit comments

Comments
 (0)