zeroshade commented on code in PR #1141:
URL: https://github.com/apache/arrow-go/pull/1141#discussion_r3769712382


##########
arrow/ipc/writer.go:
##########
@@ -527,7 +529,9 @@ func (w *recordEncoder) encode(p *Payload, rec 
arrow.RecordBatch) error {
                        return fmt.Errorf("%w: minSpaceSavings not in range 
[0,1]. Provided %.05f",
                                arrow.ErrInvalid, w.minSpaceSavings)
                }
-               w.compressBodyBuffers(p)
+               if err := w.compressBodyBuffers(p); err != nil {

Review Comment:
   Returning this error introduces a leak through `GetRecordBatchPayload`. That 
helper returns `Payload{}` when `enc.Encode` fails without releasing its local 
`data`, although encoding has already retained or allocated its body 
buffers—and may have replaced earlier buffers before a later compression 
failure.
   
   A checked-allocator probe leaves 128 bytes allocated on this path. Please 
release the partial payload before discarding it:
   
   ```go
   if err := enc.Encode(&data, batch); err != nil {
       data.Release()
       return Payload{}, err
   }
   ```
   
   Please also cover this public-helper path for compressor `Write` and `Close` 
failures.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to