From 489ca2593cd6745dc4aa245b9646ea0dcf7e4497 Mon Sep 17 00:00:00 2001 From: Richard Artoul Date: Thu, 6 Feb 2020 11:16:20 -0500 Subject: [PATCH] Fix array.setData() to retain before release (#4) --- go/arrow/array/array.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go/arrow/array/array.go b/go/arrow/array/array.go index 9fc4cc0be6db3..9cbaef9ff1236 100644 --- a/go/arrow/array/array.go +++ b/go/arrow/array/array.go @@ -119,11 +119,13 @@ func (a *array) IsValid(i int) bool { } func (a *array) setData(data *Data) { + // Retain before releasing in case a.data is the same as data. + data.Retain() + if a.data != nil { a.data.Release() } - data.Retain() if len(data.buffers) > 0 && data.buffers[0] != nil { a.nullBitmapBytes = data.buffers[0].Bytes() }