Skip to content

Commit

Permalink
Fixed Filesystem couldn't close file bug #2270 (#2271)
Browse files Browse the repository at this point in the history
Signed-off-by: João Reigota <[email protected]>
  • Loading branch information
joaoReigota1 authored Mar 16, 2021
1 parent bc73099 commit 127384f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/kics/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ func (s *Service) StartScan(ctx context.Context, scanID string, hideProgress boo
getContent will read the passed file 1MB at a time
to prevent resource exhaustion and return its content
*/
func getContent(rc io.ReadCloser) (*[]byte, error) {
func getContent(rc io.Reader) (*[]byte, error) {
maxSizeMB := 5 // Max size of file in MBs
defer rc.Close()
var content []byte
data := make([]byte, 1048576)
for {
Expand Down

0 comments on commit 127384f

Please sign in to comment.