Skip to content

Commit

Permalink
Merge pull request #2 from pedrinimm/develop
Browse files Browse the repository at this point in the history
New release preparation with GM-1 fix
  • Loading branch information
pedrinimm authored May 31, 2019
2 parents 859b151 + 472d064 commit 31520d0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gomilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@ func Go_xxfi_close(ctx *C.SMFICTX) C.sfsistat {
if milter.GetDebug() {
logger.Printf("Close callback returned: %d\n", code)
}

// Verify if the private data from ctx is already NULL
// Call libmilter smfi_getpriv to get a pointer to our data
CArray := (*byte)(C.smfi_getpriv(ctx))
pointerToData := unsafe.Pointer(CArray)
if pointerToData != nil {
lenStart := uintptr(unsafe.Pointer(CArray))
// Free the data malloc'ed by C
C.free(unsafe.Pointer(lenStart))
C.smfi_setpriv(ctx, nil)
}


return C.sfsistat(code)
}

Expand Down

0 comments on commit 31520d0

Please sign in to comment.