---
src/main/java/org/libvirt/DomainSnapshot.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/DomainSnapshot.java
b/src/main/java/org/libvirt/DomainSnapshot.java
index 4736a71..3013117 100644
--- a/src/main/java/org/libvirt/DomainSnapshot.java
+++ b/src/main/java/org/libvirt/DomainSnapshot.java
@@ -4,6 +4,8 @@ import org.libvirt.jna.DomainSnapshotPointer;
import static org.libvirt.Library.libvirt;
import static org.libvirt.ErrorHandler.processError;
+import com.sun.jna.Pointer;
+
public class DomainSnapshot {
/**
@@ -71,6 +73,12 @@ public class DomainSnapshot {
* @return the XML document
*/
public String getXMLDesc() throws LibvirtException {
- return processError(libvirt.virDomainSnapshotGetXMLDesc(VDSP, 0));
+ Pointer p = processError(libvirt.virDomainSnapshotGetXMLDesc(VDSP, 0));
+
+ 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 e0096e3..4017269 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -379,7 +379,7 @@ public interface Libvirt extends Library {
DomainSnapshotPointer virDomainSnapshotCreateXML(DomainPointer virDomainPtr, String
xmlDesc, int flags);
DomainSnapshotPointer virDomainSnapshotCurrent(DomainPointer virDomainPtr, int
flags);
int virDomainSnapshotDelete(DomainSnapshotPointer virDomainSnapshotPtr, int flags);
- String virDomainSnapshotGetXMLDesc(DomainSnapshotPointer virDomainSnapshotPtr, int
flags);
+ Pointer virDomainSnapshotGetXMLDesc(DomainSnapshotPointer virDomainSnapshotPtr, int
flags);
int virDomainSnapshotFree(DomainSnapshotPointer virDomainSnapshotPtr);
int virDomainSnapshotListNames(DomainPointer virDomainPtr, Pointer[] names, int
nameslen, int flags);
DomainSnapshotPointer virDomainSnapshotLookupByName(DomainPointer virDomainPtr,
String name, int flags);
--
1.8.5.2.msysgit.0