Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx> --- src/main/java/org/libvirt/StorageVol.java | 10 +++++++++- src/main/java/org/libvirt/jna/Libvirt.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/libvirt/StorageVol.java b/src/main/java/org/libvirt/StorageVol.java index 1573070..7035c93 100644 --- a/src/main/java/org/libvirt/StorageVol.java +++ b/src/main/java/org/libvirt/StorageVol.java @@ -6,6 +6,8 @@ import org.libvirt.jna.virStorageVolInfo; import static org.libvirt.Library.libvirt; import static org.libvirt.ErrorHandler.processError; +import com.sun.jna.Pointer; + /** * An acutal storage bucket. */ @@ -161,7 +163,13 @@ public class StorageVol { * @throws LibvirtException */ public String getPath() throws LibvirtException { - return processError(libvirt.virStorageVolGetPath(VSVP)); + Pointer p = processError(libvirt.virStorageVolGetPath(VSVP)); + + try { + return Library.getString(p); + } finally { + Library.free(p); + } } /** diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java index 33b5f8c..97907d0 100644 --- a/src/main/java/org/libvirt/jna/Libvirt.java +++ b/src/main/java/org/libvirt/jna/Libvirt.java @@ -326,7 +326,7 @@ public interface Libvirt extends Library { int virStorageVolGetInfo(StorageVolPointer storageVolPtr, virStorageVolInfo info); String virStorageVolGetKey(StorageVolPointer storageVolPtr); String virStorageVolGetName(StorageVolPointer storageVolPtr); - String virStorageVolGetPath(StorageVolPointer storageVolPtr); + Pointer virStorageVolGetPath(StorageVolPointer storageVolPtr); String virStorageVolGetXMLDesc(StorageVolPointer storageVolPtr, int flags); StorageVolPointer virStorageVolLookupByKey(ConnectionPointer virConnectPtr, String name); StorageVolPointer virStorageVolLookupByName(StoragePoolPointer storagePoolPtr, String name); -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list