Use bufferpool in Rst handler
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 10 Jul 2016 10:54:15 +0000 (12:54 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 10 Jul 2016 10:54:15 +0000 (12:54 +0200)
helpers/content.go

index 6da437b3d59f86eba044c14a3ddd9172ac2839e2..96eeba891f19a4ef96c5ea5374320b27758aad41 100644 (file)
@@ -517,8 +517,9 @@ func getRstContent(content []byte) []byte {
 
        cmd := exec.Command(path, "--leave-comments")
        cmd.Stdin = bytes.NewReader(cleanContent)
-       var out bytes.Buffer
-       cmd.Stdout = &out
+       out := bufferpool.GetBuffer()
+       defer bufferpool.PutBuffer(out)
+       cmd.Stdout = out
        if err := cmd.Run(); err != nil {
                jww.ERROR.Println(err)
        }