Skip to content

Commit

Permalink
layerStore.Diff(): don't use an unnecessary buffer
Browse files Browse the repository at this point in the history
Don't ReadAll() from a Reader to create a buffer and then create another
Reader to read from that buffer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
  • Loading branch information
nalind committed Dec 9, 2021
1 parent 4cd5fa1 commit e73e9a7
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1471,12 +1471,7 @@ func (r *layerStore) Diff(from, to string, options *DiffOptions) (io.ReadCloser,
}
defer decompressor.Close()

tsbytes, err := ioutil.ReadAll(decompressor)
if err != nil {
return nil, err
}

metadata = storage.NewJSONUnpacker(bytes.NewBuffer(tsbytes))
metadata = storage.NewJSONUnpacker(decompressor)

fgetter, err := r.newFileGetter(to)
if err != nil {
Expand Down

0 comments on commit e73e9a7

Please sign in to comment.