Skip to content

Commit 41c7981

Browse files
committed
Fixed allocation in value returned after SPI_finish
1 parent 54d7df1 commit 41c7981

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/postgresql/cloudsync_postgresql.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ static bytea *cloudsync_init_internal (cloudsync_context *data, const char *tabl
304304
cloudsync_update_schema_hash(data);
305305

306306
// Build site_id as bytea to return
307-
result = (bytea *)palloc(UUID_LEN + VARHDRSZ);
307+
// Use SPI_palloc so the allocation survives SPI_finish
308+
result = (bytea *)SPI_palloc(UUID_LEN + VARHDRSZ);
308309
SET_VARSIZE(result, UUID_LEN + VARHDRSZ);
309310
memcpy(VARDATA(result), cloudsync_siteid(data), UUID_LEN);
310311

0 commit comments

Comments
 (0)