close r/w (#1810)
Co-authored-by: huanghuan.27@bytedance.com <huanghuan.27@bytedance.com>
This commit is contained in:
parent
3468331506
commit
e5db6ea8a7
@ -85,6 +85,7 @@ func encode(txt *mdnsTxt) ([]string, error) {
|
|||||||
|
|
||||||
w := zlib.NewWriter(&buf)
|
w := zlib.NewWriter(&buf)
|
||||||
if _, err := w.Write(b); err != nil {
|
if _, err := w.Write(b); err != nil {
|
||||||
|
w.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
w.Close()
|
w.Close()
|
||||||
@ -119,6 +120,7 @@ func decode(record []string) (*mdnsTxt, error) {
|
|||||||
|
|
||||||
br := bytes.NewReader(hr)
|
br := bytes.NewReader(hr)
|
||||||
zr, err := zlib.NewReader(br)
|
zr, err := zlib.NewReader(br)
|
||||||
|
defer zr.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user