Browse Source

fix: theoretical leak in clisit.Init (#6302)

pull/6309/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
0811c7be99
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 13 deletions
  1. +8
    -13
      libs/clist/clist.go

+ 8
- 13
libs/clist/clist.go View File

@ -229,18 +229,6 @@ type CList struct {
maxLen int // max list length
}
func (l *CList) Init() *CList {
l.mtx.Lock()
l.wg = waitGroup1()
l.waitCh = make(chan struct{})
l.head = nil
l.tail = nil
l.len = 0
l.mtx.Unlock()
return l
}
// Return CList with MaxLength. CList will panic if it goes beyond MaxLength.
func New() *CList { return newWithMax(MaxLength) }
@ -249,7 +237,14 @@ func New() *CList { return newWithMax(MaxLength) }
func newWithMax(maxLength int) *CList {
l := new(CList)
l.maxLen = maxLength
return l.Init()
l.wg = waitGroup1()
l.waitCh = make(chan struct{})
l.head = nil
l.tail = nil
l.len = 0
return l
}
func (l *CList) Len() int {


Loading…
Cancel
Save