From c9fb213776d3f5e4cbbba054f29cf5de8310e0c5 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Tue, 23 Aug 2016 10:39:02 +0200 Subject: [PATCH] fix type mismatch in slot_deform_datarow (void* vs. Datum) The pfree() expects void*, but was getting pointer packed as a Datum. So instead use 'val' with the Datum converted as a pointer, and also ditch the pointless null check (we're doing memcpy from the pointer so we'd get segfault anyway). --- src/backend/access/common/heaptuple.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index ff3b25e32f..ffc48bd8b1 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -1326,10 +1326,9 @@ slot_deform_datarow(TupleTableSlot *slot) data = MemoryContextAlloc(slot->tts_drowcxt, data_length); memcpy(data, val, data_length); - if (slot->tts_values[i]) - pfree(slot->tts_values[i]); + pfree(val); - slot->tts_values[i] = (Datum) data; + slot->tts_values[i] = PointerGetDatum(data); } } } -- 2.39.5