Skip to content

Commit 489ca25

Browse files
richardartoulRichard Artoul
authored and
Richard Artoul
committed
Fix array.setData() to retain before release (#4)
1 parent 88cd05f commit 489ca25

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

go/arrow/array/array.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ func (a *array) IsValid(i int) bool {
119119
}
120120

121121
func (a *array) setData(data *Data) {
122+
// Retain before releasing in case a.data is the same as data.
123+
data.Retain()
124+
122125
if a.data != nil {
123126
a.data.Release()
124127
}
125128

126-
data.Retain()
127129
if len(data.buffers) > 0 && data.buffers[0] != nil {
128130
a.nullBitmapBytes = data.buffers[0].Bytes()
129131
}

0 commit comments

Comments
 (0)