Merge pull request #2 from ndrpnt/main

Make Free() return Go error instead of C error code
This commit is contained in:
ca110us 2022-04-22 15:11:54 +08:00 committed by GitHub
commit 3ef7191ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -176,8 +176,12 @@ func (c *Clamav) EngineGetNum(field EngineField) (uint64, error) {
// Free the memory allocated to clamav instance, Free should be called
// when the engine is no longer in use.
func (c *Clamav) Free() int {
return int(C.cl_engine_free((*C.struct_cl_engine)(c.engine)))
func (c *Clamav) Free() error {
ret := ErrorCode(C.cl_engine_free((*C.struct_cl_engine)(c.engine)))
if ret == CL_SUCCESS {
return nil
}
return Strerr(ret)
}
// ScanMapCB scans custom data