Skip to content

Commit

Permalink
lfs: don't close pointer scanner on error
Browse files Browse the repository at this point in the history
On error, we used to attempt to close the pointer scanner to free the
resources that were associated with git cat-file --batch.  However, now
that we're using a gitobj-based scanner, there are no resources of that
kind to free.  Moreover, we only return an error if we return nil for
the scanner object, so attempting to close the scanner leads to a nil
pointer dereference.

Remove the calls to close the scanner when an error occurs.

Signed-off-by: brian m. carlson <[email protected]>
  • Loading branch information
bk2204 committed Nov 16, 2018
1 parent c825e5a commit 7dae495
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions commands/command_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ func statusCommand(cmd *cobra.Command, args []string) {

scanner, err := lfs.NewPointerScanner()
if err != nil {
scanner.Close()

ExitWithError(err)
}

Expand Down
2 changes: 0 additions & 2 deletions lfs/gitscanner_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ func runScanTree(cb GitScannerFoundPointer, ref string, filter *filepathfilter.F
func catFileBatchTree(treeblobs *TreeBlobChannelWrapper) (*PointerChannelWrapper, error) {
scanner, err := NewPointerScanner()
if err != nil {
scanner.Close()

return nil, err
}

Expand Down

0 comments on commit 7dae495

Please sign in to comment.