Make Free() return Go error instead of C error code

This commit is contained in:
ndrpnt 2022-04-21 11:10:10 +02:00 committed by GitHub
parent 690024f64a
commit cfcfbd4360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 // Free the memory allocated to clamav instance, Free should be called
// when the engine is no longer in use. // when the engine is no longer in use.
func (c *Clamav) Free() int { func (c *Clamav) Free() error {
return int(C.cl_engine_free((*C.struct_cl_engine)(c.engine))) 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 // ScanMapCB scans custom data