mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Address: - github.com/docker/docker / github.com/containerd/containerd - CVE-2022-23471, CVE-2023-25153, CVE-2023-25173, CVE-2023-28840, CVE-2023-28841, CVE-2023-28842 - github.com/moby/moby - GHSA-vp35-85q5-9f25 - google.golang.org/protobuf - CVE-2023-24535, GHSA-hw7c-3rfg-p46j
44 lines
663 B
Go
44 lines
663 B
Go
package logrus
|
|
|
|
import (
|
|
"bytes"
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
bufferPool BufferPool
|
|
)
|
|
|
|
type BufferPool interface {
|
|
Put(*bytes.Buffer)
|
|
Get() *bytes.Buffer
|
|
}
|
|
|
|
type defaultPool struct {
|
|
pool *sync.Pool
|
|
}
|
|
|
|
func (p *defaultPool) Put(buf *bytes.Buffer) {
|
|
p.pool.Put(buf)
|
|
}
|
|
|
|
func (p *defaultPool) Get() *bytes.Buffer {
|
|
return p.pool.Get().(*bytes.Buffer)
|
|
}
|
|
|
|
// SetBufferPool allows to replace the default logrus buffer pool
|
|
// to better meets the specific needs of an application.
|
|
func SetBufferPool(bp BufferPool) {
|
|
bufferPool = bp
|
|
}
|
|
|
|
func init() {
|
|
SetBufferPool(&defaultPool{
|
|
pool: &sync.Pool{
|
|
New: func() interface{} {
|
|
return new(bytes.Buffer)
|
|
},
|
|
},
|
|
})
|
|
}
|