[libvirt] [PATCH go] Fix segfault in Connect.GetMemoryStats

Daniel P. Berrange berrange at redhat.com
Mon Jan 23 15:35:06 UTC 2017


On Mon, Jan 23, 2017 at 01:49:59AM +0300, Matvey Kruglov wrote:
> ---
>  connect.go | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/connect.go b/connect.go
> index 35eb7fd..6730171 100644
> --- a/connect.go
> +++ b/connect.go
> @@ -1688,7 +1688,7 @@ func (c *Connect) GetMemoryStats(cellNum int, flags uint32) (*NodeMemoryStats, e
>  	}
>  
>  	params := make([]C.virNodeMemoryStats, nparams)
> -	ret = C.virNodeGetMemoryStats(c.ptr, C.int(cellNum), (*C.virNodeMemoryStats)(unsafe.Pointer(&params)), &nparams, C.uint(flags))
> +	ret = C.virNodeGetMemoryStats(c.ptr, C.int(cellNum), (*C.virNodeMemoryStats)(unsafe.Pointer(&params[0])), &nparams, C.uint(flags))
>  	if ret == -1 {
>  		return nil, GetLastError()
>  	}

FYI, I already merged the same patch you submitted a pull request for
since it was trivial and didn't require tricky review.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list