[Libvirt-cim] [PATCH] Fix seg fault in KVMRedirectionSAP; fix typos in error messages

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Nov 19 17:12:42 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1227114709 28800
# Node ID 7ab817cec936597c1f0b06e4448439711f311e87
# Parent  087bd497d4ed6fbf1b2a00dac26a7c6f8baf91e2
Fix seg fault in KVMRedirectionSAP; fix typos in error messages.

The name field in the vnc_port struct only needs to be freed if the struct has
been initialized.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 087bd497d4ed -r 7ab817cec936 src/Virt_KVMRedirectionSAP.c
--- a/src/Virt_KVMRedirectionSAP.c	Tue Nov 18 09:37:05 2008 -0800
+++ b/src/Virt_KVMRedirectionSAP.c	Wed Nov 19 09:11:49 2008 -0800
@@ -390,14 +390,15 @@
         if (cu_get_str_path(ref, "Name", &name) != CMPI_RC_OK) {
                 cu_statusf(broker, &s,
                            CMPI_RC_ERR_NOT_FOUND,
-                           "No such instance (System)");
+                           "No such instance (Name)");
                 goto out;
         }
 
         if (sscanf(name, "%d:%d", &lport, &rport) != 2) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
-                           "Unable to guest's console port");
+                           "Unable to determine console port for guest '%s'",
+                           sys);
                 goto out;
         }
 
@@ -431,7 +432,8 @@
 
  out:
         virConnectClose(conn);
-        free(port->name);
+        if (port != NULL)
+                free(port->name);
         free(port);
 
         return s;




More information about the Libvirt-cim mailing list