rados: Fix iterator memory allocation; allocating a c_entry is not necessary and performed directly by the library.

This commit is contained in:
Livio Soares 2016-03-25 00:08:28 -04:00
parent 373a3043d7
commit 2d33c55c6b
1 changed files with 3 additions and 5 deletions

View File

@ -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, &centry, 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
}