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

[libvirt] [PATCH 1/2] apparmor: Avoid freeing uninitialized pointer



---
 src/security/security_apparmor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 2b9c337..c23ba87 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -150,61 +150,61 @@ profile_status_file(const char *str)
         virReportOOMError();
         goto failed;
     }
 
     if (strstr(content, tmp) != NULL)
         rc = 0;
     else
         rc = 1;
 
   failed:
     VIR_FREE(tmp);
     VIR_FREE(profile);
     VIR_FREE(content);
 
     return rc;
 }
 
 /*
  * load (add) a profile. Will create one if necessary
  */
 static int
 load_profile(virSecurityManagerPtr mgr,
              const char *profile,
              virDomainDefPtr def,
              const char *fn,
              bool append)
 {
     int rc = -1;
     bool create = true;
     char *xml = NULL;
-    virCommandPtr cmd;
+    virCommandPtr cmd = NULL;
     const char *probe = virSecurityManagerGetAllowDiskFormatProbing(mgr)
         ? "1" : "0";
 
     xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
     if (!xml)
         goto cleanup;
 
     if (profile_status_file(profile) >= 0)
         create = false;
 
     cmd = virCommandNewArgList(VIRT_AA_HELPER, "-p", probe,
                                create ? "-c" : "-r",
                                "-u", profile, NULL);
     if (!create && fn) {
         if (append) {
             virCommandAddArgList(cmd, "-F", fn, NULL);
         } else {
             virCommandAddArgList(cmd, "-f", fn, NULL);
         }
     }
 
     virCommandSetInputBuffer(cmd, xml);
     rc = virCommandRun(cmd, NULL);
 
 cleanup:
     VIR_FREE(xml);
     virCommandFree(cmd);
 
     return rc;
 }
-- 
1.8.1.1


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