mirror of https://github.com/grpc/grpc-go.git
Check error when calling compressor.Compress (#2274)
Compress can return an error, which was not checked.
This commit is contained in:
parent
acd1429515
commit
f2aaa9bf74
|
|
@ -531,7 +531,10 @@ func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte,
|
||||||
}
|
}
|
||||||
cbuf := &bytes.Buffer{}
|
cbuf := &bytes.Buffer{}
|
||||||
if compressor != nil {
|
if compressor != nil {
|
||||||
z, _ := compressor.Compress(cbuf)
|
z, err := compressor.Compress(cbuf)
|
||||||
|
if err != nil {
|
||||||
|
return nil, wrapErr(err)
|
||||||
|
}
|
||||||
if _, err := z.Write(in); err != nil {
|
if _, err := z.Write(in); err != nil {
|
||||||
return nil, wrapErr(err)
|
return nil, wrapErr(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue