Skip to content

Commit e90bf9b

Browse files
Fix uninitialized memory in C API (#98)
`AllocHGlobal` does not zero-initialize the memory it allocates. This change fixes the `RecordBatch` exporter to correctly set the "nulls" buffer to be null instead of inheriting what it got from allocation.
1 parent 78eacbe commit e90bf9b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Apache.Arrow/C/CArrowArrayExporter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ private unsafe static void ConvertRecordBatch(ExportedAllocationOwner sharedOwne
184184

185185
cArray->n_buffers = 1;
186186
cArray->buffers = (byte**)sharedOwner.Allocate(IntPtr.Size);
187+
cArray->buffers[0] = null;
187188

188189
cArray->n_children = batch.ColumnCount;
189190
cArray->children = null;

0 commit comments

Comments
 (0)