Skip to content

Commit

Permalink
Fix nil pointer exception in stat (cs3org#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 authored and glpatcern committed Sep 23, 2021
1 parent 77de79c commit f0c31a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/fix-stat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: Fix nil pointer exception in stat

https://github.com/cs3org/reva/pull/2078
9 changes: 3 additions & 6 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ func (s *svc) statAcrossProviders(ctx context.Context, req *provider.StatRequest

for i, p := range providers {
wg.Add(1)
go s.statOnProvider(ctx, req, infoFromProviders[i], p, &errors[i], &wg)
go s.statOnProvider(ctx, req, &infoFromProviders[i], p, &errors[i], &wg)
}
wg.Wait()

Expand Down Expand Up @@ -1348,7 +1348,7 @@ func (s *svc) statAcrossProviders(ctx context.Context, req *provider.StatRequest
}, nil
}

func (s *svc) statOnProvider(ctx context.Context, req *provider.StatRequest, res *provider.ResourceInfo, p *registry.ProviderInfo, e *error, wg *sync.WaitGroup) {
func (s *svc) statOnProvider(ctx context.Context, req *provider.StatRequest, res **provider.ResourceInfo, p *registry.ProviderInfo, e *error, wg *sync.WaitGroup) {
defer wg.Done()
c, err := s.getStorageProviderClient(ctx, p)
if err != nil {
Expand All @@ -1370,10 +1370,7 @@ func (s *svc) statOnProvider(ctx context.Context, req *provider.StatRequest, res
*e = errors.Wrap(err, fmt.Sprintf("gateway: error calling Stat %s on %+v", req.Ref, p))
return
}
if res == nil {
res = &provider.ResourceInfo{}
}
*res = *r.Info
*res = r.Info
}

func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.StatResponse, error) {
Expand Down

0 comments on commit f0c31a7

Please sign in to comment.