[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] segfailt in openvz driver



There was segmentation failt in openvz driver during 'create' command if domain with same id exist. Segfault was because of using structure (print warning with name of container) which is free.


other:
use openvzError instead of openvzLog.
Index: openvz_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.47
diff -u -p -r1.47 openvz_driver.c
--- openvz_driver.c	8 Sep 2008 12:15:33 -0000	1.47
+++ openvz_driver.c	11 Sep 2008 12:37:24 -0000
@@ -436,9 +436,10 @@ openvzDomainDefineXML(virConnectPtr conn
 
     vm = virDomainFindByName(driver->domains, vmdef->name);
     if (vm) {
-        virDomainDefFree(vmdef);
-        openvzLog(OPENVZ_ERR, _("Already an OPENVZ VM active with the id '%s'"),
+        openvzError(conn, VIR_ERR_OPERATION_FAILED,
+                  _("Already an OPENVZ VM active with the id '%s'"),
                   vmdef->name);
+        virDomainDefFree(vmdef);
         return NULL;
     }
     if (!(vm = virDomainAssignDef(conn, &driver->domains, vmdef))) {
@@ -512,10 +513,10 @@ openvzDomainCreateLinux(virConnectPtr co
 
     vm = virDomainFindByName(driver->domains, vmdef->name);
     if (vm) {
+        openvzError(conn, VIR_ERR_OPERATION_FAILED,
+                  _("Already an OPENVZ VM defined with the id '%s'"),
+                  vmdef->name);
         virDomainDefFree(vmdef);
-        openvzLog(OPENVZ_ERR,
-                  _("Already an OPENVZ VM defined with the id '%d'"),
-                strtoI(vmdef->name));
         return NULL;
     }
     if (!(vm = virDomainAssignDef(conn, &driver->domains, vmdef))) {

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]