[libvir] [PATCH] Double free in openvzGetVPSInfo

Anton Protopopov aspsk2 at gmail.com
Thu Feb 21 15:07:48 UTC 2008


Hi,
without this openvzGetVPSInfo() will cause "double free" when parse bad (i.e.,
really bad or empty) output from vzlist.

diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 482de82..0bc7084 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -536,7 +536,6 @@ openvzGetVPSInfo(virConnectPtr conn) {
         if (fscanf(fp, "%d %s\n", &veid, status) != 2) {
            error(conn, VIR_ERR_INTERNAL_ERROR,
                  "Failed to parse vzlist output");
-            free(*pnext);
            goto error;
        }
         if(strcmp(status, "stopped")) {
@@ -557,7 +556,6 @@ openvzGetVPSInfo(virConnectPtr conn) {
         vmdef = calloc(1, sizeof(*vmdef));
         if(!vmdef) {
             error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
-            free(*pnext);
            goto error;
         }

@@ -568,7 +566,6 @@ openvzGetVPSInfo(virConnectPtr conn) {
         if(ret == -1) {
             error(conn, VIR_ERR_INTERNAL_ERROR,
                  "UUID in config file malformed");
-            free(*pnext);
            free(vmdef);
             goto error;
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080221/988dd8e6/attachment-0001.htm>


More information about the libvir-list mailing list