提交 e0952bad 编写于 作者: M Mark McLoughlin

Mon Feb 26 14:20:18 IST 2007 Mark McLoughlin <markmc@redhat.com>

        * qemud/conf.c: check for malloc failure in GenerateXML()
        and GenerateNetworkXML()

        * qemud/driver.c: free the XML output after returning it
        from the DumpXML() commands.
上级 1920ed8a
Mon Feb 26 14:20:18 IST 2007 Mark McLoughlin <markmc@redhat.com>
* qemud/conf.c: check for malloc failure in GenerateXML()
and GenerateNetworkXML()
* qemud/driver.c: free the XML output after returning it
from the DumpXML() commands.
Fri Feb 23 12:14:34 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/driver.c, qemud/internal.h, qemud/qemud.c, qemud/conf.c,
......
......@@ -2216,6 +2216,9 @@ char *qemudGenerateXML(struct qemud_server *server,
buf.used = 0;
buf.data = malloc(buf.len);
if (!buf.data)
goto no_memory;
switch (def->virtType) {
case QEMUD_VIRT_QEMU:
type = "qemu";
......@@ -2432,7 +2435,8 @@ char *qemudGenerateXML(struct qemud_server *server,
no_memory:
qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
cleanup:
free(buf.data);
if (buf.data)
free(buf.data);
return NULL;
}
......@@ -2447,6 +2451,9 @@ char *qemudGenerateNetworkXML(struct qemud_server *server,
buf.used = 0;
buf.data = malloc(buf.len);
if (!buf.data)
goto no_memory;
if (qemudBufferPrintf(&buf, "<network>\n") < 0)
goto no_memory;
......@@ -2508,7 +2515,8 @@ char *qemudGenerateNetworkXML(struct qemud_server *server,
no_memory:
qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
free(buf.data);
if (buf.data)
free(buf.data);
return NULL;
}
......
......@@ -432,6 +432,8 @@ int qemudDomainDumpXML(struct qemud_server *server, const unsigned char *uuid, c
strncpy(xml, vmxml, xmllen);
xml[xmllen-1] = '\0';
free(xml);
return 0;
}
......@@ -741,6 +743,8 @@ int qemudNetworkDumpXML(struct qemud_server *server, const unsigned char *uuid,
strncpy(xml, networkxml, xmllen);
xml[xmllen-1] = '\0';
free(xml);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册