Skip to content

Commit c748ca3

Browse files
committed
Fixes go pointer with go pointer check, which panicked on getting the cookies list
1 parent fd49ff2 commit c748ca3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

easy.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ import (
6666
"fmt"
6767
"mime"
6868
"path"
69-
"unsafe"
7069
"sync"
70+
"unsafe"
7171
)
7272

7373
type CurlInfo C.CURLINFO
@@ -137,7 +137,7 @@ func (c *contextMap) Delete(k uintptr) {
137137
delete(c.items, k)
138138
}
139139

140-
var context_map = &contextMap {
140+
var context_map = &contextMap{
141141
items: make(map[uintptr]*CURL),
142142
}
143143

@@ -405,8 +405,9 @@ func (curl *CURL) Getinfo(info CurlInfo) (ret interface{}, err error) {
405405
debugf("Getinfo %s", ret)
406406
return ret, err
407407
case C.CURLINFO_SLIST:
408-
a_ptr_slist := new(C.struct_curl_slist)
408+
var a_ptr_slist *C.struct_curl_slist
409409
err := newCurlError(C.curl_easy_getinfo_slist(p, cInfo, &a_ptr_slist))
410+
defer C.curl_slist_free_all(a_ptr_slist)
410411
ret := []string{}
411412
for a_ptr_slist != nil {
412413
debugf("Getinfo %s %v", C.GoString(a_ptr_slist.data), a_ptr_slist.next)

0 commit comments

Comments
 (0)