From: Tomas Vondra Date: Tue, 23 Aug 2016 08:39:02 +0000 (+0200) Subject: fix type mismatch in slot_deform_datarow (void* vs. Datum) X-Git-Tag: XL9_5_R1_4~44 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=c9fb213776d3f5e4cbbba054f29cf5de8310e0c5;p=postgres-xl.git 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). --- 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); } } }