File: fix-test-memory-leaks.patch

package info (click to toggle)
golang-github-valyala-gozstd 1.9.0%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 300 kB
  • sloc: makefile: 45
file content (32 lines) | stat: -rw-r--r-- 894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: Fix memory leaks in uni tests
 We need to release resources, otherwise we run out of memory on 32-bit
 systems that do not have enough RAM.
Author: Guillem Jover <gjover@sipwise.com>
Origin: other, Sipwise
Forwarded: no
Last-Update: 2021-01-13

---
 writer_test.go |    3 +++
 1 file changed, 3 insertions(+)

--- a/writer_test.go
+++ b/writer_test.go
@@ -227,6 +227,7 @@ func TestWriterWindowLog(t *testing.T) {
 			if !bytes.Equal(plainData, src) {
 				t.Fatalf("unexpected data obtained after decompression on level %d wlog %d; got\n%X; want\n%X", level, wlog, plainData, src)
 			}
+			zr.Release()
 		}
 	}
 }
@@ -432,7 +433,9 @@ func testWriterExt(zw *Writer, s string)
 func TestWriterBig(t *testing.T) {
 	pr, pw := io.Pipe()
 	zw := NewWriter(pw)
+	defer zw.Release()
 	zr := NewReader(pr)
+	defer zr.Release()
 
 	doneCh := make(chan error)
 	var writtenBB bytes.Buffer