]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: check for NULL parameter in virFileWrapperFdCatchError
authorJán Tomko <jtomko@redhat.com>
Wed, 28 Nov 2012 14:59:07 +0000 (15:59 +0100)
committerOsier Yang <jyang@redhat.com>
Wed, 28 Nov 2012 16:00:39 +0000 (00:00 +0800)
This reverts 8927c0e qemu: fix a crash when save file can't be opened
and allows virFileWrapperFdCatchError to be called with NULL instead.

src/qemu/qemu_driver.c
src/util/virfile.c

index d027880d258ffe17f556163bf7b30fcf0d241c4b..374dcd84d495099014f138ce59d57f4613163768 100644 (file)
@@ -2908,8 +2908,7 @@ qemuDomainSaveMemory(struct qemud_driver *driver,
 
 cleanup:
     VIR_FORCE_CLOSE(fd);
-    if (wrapperFd)
-        virFileWrapperFdCatchError(wrapperFd);
+    virFileWrapperFdCatchError(wrapperFd);
     virFileWrapperFdFree(wrapperFd);
     VIR_FREE(xml);
 
@@ -3365,8 +3364,7 @@ doCoreDump(struct qemud_driver *driver,
 cleanup:
     VIR_FORCE_CLOSE(fd);
     if (ret != 0) {
-        if (wrapperFd)
-            virFileWrapperFdCatchError(wrapperFd);
+        virFileWrapperFdCatchError(wrapperFd);
         unlink(path);
     }
     virFileWrapperFdFree(wrapperFd);
index 95931517473b0c8e7179223b88adf625d8868a21..c79ef04a620adce8b50d8b2d4ac88afcf920f37e 100644 (file)
@@ -369,7 +369,7 @@ virFileWrapperFdClose(virFileWrapperFdPtr wfd)
 void
 virFileWrapperFdCatchError(virFileWrapperFdPtr wfd)
 {
-    if (wfd->err_msg)
+    if (wfd && wfd->err_msg)
         VIR_WARN("iohelper reports: %s", wfd->err_msg);
 }