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

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

 



---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]