Skip to content

Commit b9d4cd3

Browse files
committed
fix release
Signed-off-by: Cai Zhang <[email protected]>
1 parent 803df72 commit b9d4cd3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arrow/cdata/cdata.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ func (imp *cimporter) doImportArr(src *CArrowArray) error {
461461
imp.alloc = &importAllocator{arr: imp.arr}
462462
}
463463

464+
if err := imp.doImport(); err != nil {
465+
return err
466+
}
467+
464468
// we tie the releasing of the array to when the buffers are
465469
// cleaned up, so if there are no buffers that we've imported
466470
// such as for a null array or a nested array with no bitmap
@@ -469,14 +473,12 @@ func (imp *cimporter) doImportArr(src *CArrowArray) error {
469473
// memory that we have to track the lifetime of.
470474
defer func() {
471475
if imp.alloc.bufCount.Load() == 0 {
472-
if C.ArrowArrayIsReleased(imp.arr) == 0 {
473-
C.ArrowArrayRelease(imp.arr)
474-
C.free(unsafe.Pointer(imp.arr))
475-
}
476+
C.ArrowArrayRelease(imp.arr)
477+
C.free(unsafe.Pointer(imp.arr))
476478
}
477479
}()
478480

479-
return imp.doImport()
481+
return nil
480482
}
481483

482484
// import is called recursively as needed for importing an array and its children

0 commit comments

Comments
 (0)