]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix printing of pathnames on error in qemuDomainSnapshotLoad.
authorChris Lalancette <clalance@redhat.com>
Fri, 23 Apr 2010 15:59:02 +0000 (11:59 -0400)
committerChris Lalancette <clalance@redhat.com>
Fri, 23 Apr 2010 18:22:48 +0000 (14:22 -0400)
While doing some testing of the snapshot code I noticed that
if qemuDomainSnapshotLoad failed, it would print a NULL as
part of the error.  That's not desirable, so leave the
full_path variable around until after we are done printing
errors.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
src/qemu/qemu_driver.c

index 0a0d9bc88ffdab615fbdb560f646ea71e1fb823f..3c4876eb82100ad6fe02218804241fd7e146e484 100644 (file)
@@ -1388,11 +1388,11 @@ static void qemuDomainSnapshotLoad(void *payload,
         }
 
         ret = virFileReadAll(fullpath, 1024*1024*1, &xmlStr);
-        VIR_FREE(fullpath);
         if (ret < 0) {
             /* Nothing we can do here, skip this one */
             VIR_ERROR("Failed to read snapshot file %s: %s", fullpath,
                       virStrerror(errno, ebuf, sizeof(ebuf)));
+            VIR_FREE(fullpath);
             continue;
         }
 
@@ -1400,12 +1400,14 @@ static void qemuDomainSnapshotLoad(void *payload,
         if (def == NULL) {
             /* Nothing we can do here, skip this one */
             VIR_ERROR("Failed to parse snapshot XML from file '%s'", fullpath);
+            VIR_FREE(fullpath);
             VIR_FREE(xmlStr);
             continue;
         }
 
         virDomainSnapshotAssignDef(&vm->snapshots, def);
 
+        VIR_FREE(fullpath);
         VIR_FREE(xmlStr);
     }