mirror of https://github.com/ceph/go-ceph
rados: Fix iterator memory allocation; allocating a c_entry is not necessary and performed directly by the library.
This commit is contained in:
parent
373a3043d7
commit
2d33c55c6b
|
@ -578,14 +578,12 @@ func (iter *Iter) Seek(token IterToken) {
|
|||
// return iter.Err()
|
||||
//
|
||||
func (iter *Iter) Next() bool {
|
||||
centry := (*C.char)(C.calloc(1, 1024))
|
||||
defer C.free(unsafe.Pointer(centry))
|
||||
|
||||
if cerr := C.rados_objects_list_next(iter.ctx, ¢ry, nil); cerr < 0 {
|
||||
var c_entry *C.char
|
||||
if cerr := C.rados_objects_list_next(iter.ctx, &c_entry, nil); cerr < 0 {
|
||||
iter.err = GetRadosError(cerr)
|
||||
return false
|
||||
}
|
||||
iter.entry = C.GoString(centry)
|
||||
iter.entry = C.GoString(c_entry)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue