golang: Don't try to free the result of guestfs_last_error.

The return value is a constant string, part of the handle, and
it must not be freed by the golang code.
This commit is contained in:
Richard W.M. Jones
2013-07-04 15:27:12 +01:00
parent bb09c4a448
commit 43121a02e7

View File

@@ -112,8 +112,8 @@ func (e *GuestfsError) String() string {
}
func get_error_from_handle (g *Guestfs, op string) *GuestfsError {
// NB: DO NOT try to free c_errmsg!
c_errmsg := C.guestfs_last_error (g.g)
defer C.free (unsafe.Pointer (c_errmsg))
errmsg := C.GoString (c_errmsg)
errno := syscall.Errno (C.guestfs_last_errno (g.g))