#include "buf.h"
#include "console.h"
#include "util.h"
+#include "memory.h"
static char *progname;
ctl->conn = NULL;
}
- free(ctl->name);
+ VIR_FREE(ctl->name);
ctl->name = vshStrdup(ctl, vshCommandOptString(cmd, "name", NULL));
if (!ro) {
xml = xmlReadDoc((const xmlChar *) doc, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
- free(doc);
+ VIR_FREE(doc);
if (!xml)
goto cleanup;
ctxt = xmlXPathNewContext(xml);
xmlXPathFreeContext(ctxt);
if (xml)
xmlFreeDoc(xml);
- free(thisHost);
- free(thatHost);
+ VIR_FREE(thisHost);
+ VIR_FREE(thatHost);
return ret;
}
if ((maxid = virConnectListDomains(ctl->conn, &ids[0], maxid)) < 0) {
vshError(ctl, "%s", _("Failed to list active domains"));
- free(ids);
+ VIR_FREE(ids);
return FALSE;
}
maxname = virConnectNumOfDefinedDomains(ctl->conn);
if (maxname < 0) {
vshError(ctl, "%s", _("Failed to list inactive domains"));
- free(ids);
+ VIR_FREE(ids);
return FALSE;
}
if (maxname) {
if ((maxname = virConnectListDefinedDomains(ctl->conn, names, maxname)) < 0) {
vshError(ctl, "%s", _("Failed to list inactive domains"));
- free(ids);
- free(names);
+ VIR_FREE(ids);
+ VIR_FREE(names);
return FALSE;
}
/* this kind of work with domains is not atomic operation */
if (!dom) {
- free(names[i]);
+ VIR_FREE(names[i]);
continue;
}
vshPrint(ctl, "%3s %-20s %s\n", "-", names[i], state);
virDomainFree(dom);
- free(names[i]);
+ VIR_FREE(names[i]);
}
- free(ids);
- free(names);
+ VIR_FREE(ids);
+ VIR_FREE(names);
return TRUE;
}
return FALSE;
dom = virDomainCreateXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (dom != NULL) {
vshPrint(ctl, _("Domain %s created from %s\n"),
return FALSE;
dom = virDomainDefineXML(ctl->conn, buffer);
- free (buffer);
+ VIR_FREE(buffer);
if (dom != NULL) {
vshPrint(ctl, _("Domain %s defined from %s\n"),
if (schedulertype!= NULL){
vshPrint(ctl, "%-15s: %s\n", _("Scheduler"),
schedulertype);
- free(schedulertype);
+ VIR_FREE(schedulertype);
} else {
vshPrint(ctl, "%-15s: %s\n", _("Scheduler"), _("Unknown"));
goto cleanup;
}
cleanup:
- free(params);
+ VIR_FREE(params);
virDomainFree(dom);
return ret_val;
}
if ((str = virDomainGetOSType(dom))) {
vshPrint(ctl, "%-15s %s\n", _("OS Type:"), str);
- free(str);
+ VIR_FREE(str);
}
if (virDomainGetInfo(dom, &info) == 0) {
ret = FALSE;
}
- free(cpumap);
- free(cpuinfo);
+ VIR_FREE(cpumap);
+ VIR_FREE(cpuinfo);
virDomainFree(dom);
return ret;
}
VIR_USE_CPU(cpumap, cpu);
} else {
vshError(ctl, _("Physical CPU %d doesn't exist."), cpu);
- free(cpumap);
+ VIR_FREE(cpumap);
virDomainFree(dom);
return FALSE;
}
ret = FALSE;
}
- free(cpumap);
+ VIR_FREE(cpumap);
virDomainFree(dom);
return ret;
}
return FALSE;
}
vshPrint (ctl, "%s\n", caps);
- free (caps);
+ VIR_FREE(caps);
return TRUE;
}
dump = virDomainGetXMLDesc(dom, flags);
if (dump != NULL) {
printf("%s", dump);
- free(dump);
+ VIR_FREE(dump);
} else {
ret = FALSE;
}
xmlData = virConnectDomainXMLFromNative(ctl->conn, format, configData, flags);
if (xmlData != NULL) {
printf("%s", xmlData);
- free(xmlData);
+ VIR_FREE(xmlData);
} else {
ret = FALSE;
}
configData = virConnectDomainXMLToNative(ctl->conn, format, xmlData, flags);
if (configData != NULL) {
printf("%s", configData);
- free(configData);
+ VIR_FREE(configData);
} else {
ret = FALSE;
}
return FALSE;
network = virNetworkCreateXML(ctl->conn, buffer);
- free (buffer);
+ VIR_FREE(buffer);
if (network != NULL) {
vshPrint(ctl, _("Network %s created from %s\n"),
return FALSE;
network = virNetworkDefineXML(ctl->conn, buffer);
- free (buffer);
+ VIR_FREE(buffer);
if (network != NULL) {
vshPrint(ctl, _("Network %s defined from %s\n"),
dump = virNetworkGetXMLDesc(network, 0);
if (dump != NULL) {
printf("%s", dump);
- free(dump);
+ VIR_FREE(dump);
} else {
ret = FALSE;
}
if (iface)
virInterfaceFree (iface);
- free (doc);
- free (doc_edited);
- free (doc_reread);
+ VIR_FREE(doc);
+ VIR_FREE(doc_edited);
+ VIR_FREE(doc_reread);
if (tmp) {
unlink (tmp);
- free (tmp);
+ VIR_FREE(tmp);
}
return ret;
if ((maxactive = virConnectListNetworks(ctl->conn, activeNames,
maxactive)) < 0) {
vshError(ctl, "%s", _("Failed to list active networks"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
if (maxinactive < 0) {
vshError(ctl, "%s", _("Failed to list inactive networks"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
if (maxinactive) {
virConnectListDefinedNetworks(ctl->conn, inactiveNames,
maxinactive)) < 0) {
vshError(ctl, "%s", _("Failed to list inactive networks"));
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return FALSE;
}
/* this kind of work with networks is not atomic operation */
if (!network) {
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
continue;
}
_("active"),
autostartStr);
virNetworkFree(network);
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
}
for (i = 0; i < maxinactive; i++) {
virNetworkPtr network = virNetworkLookupByName(ctl->conn, inactiveNames[i]);
/* this kind of work with networks is not atomic operation */
if (!network) {
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
continue;
}
autostartStr);
virNetworkFree(network);
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
}
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return TRUE;
}
if ((maxactive = virConnectListInterfaces(ctl->conn, activeNames,
maxactive)) < 0) {
vshError(ctl, "%s", _("Failed to list active interfaces"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
maxinactive = virConnectNumOfDefinedInterfaces(ctl->conn);
if (maxinactive < 0) {
vshError(ctl, "%s", _("Failed to list inactive interfaces"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
if (maxinactive) {
virConnectListDefinedInterfaces(ctl->conn, inactiveNames,
maxinactive)) < 0) {
vshError(ctl, "%s", _("Failed to list inactive interfaces"));
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return FALSE;
}
/* this kind of work with interfaces is not atomic */
if (!iface) {
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
continue;
}
_("active"),
virInterfaceGetMACString(iface));
virInterfaceFree(iface);
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
}
for (i = 0; i < maxinactive; i++) {
virInterfacePtr iface =
/* this kind of work with interfaces is not atomic */
if (!iface) {
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
continue;
}
_("inactive"),
virInterfaceGetMACString(iface));
virInterfaceFree(iface);
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
}
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return TRUE;
}
dump = virInterfaceGetXMLDesc(iface, flags);
if (dump != NULL) {
printf("%s", dump);
- free(dump);
+ VIR_FREE(dump);
} else {
ret = FALSE;
}
return FALSE;
iface = virInterfaceDefineXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (iface != NULL) {
vshPrint(ctl, _("Interface %s defined from %s\n"),
return FALSE;
pool = virStoragePoolCreateXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s created from %s\n"),
}
dev = virNodeDeviceCreateXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (dev != NULL) {
vshPrint(ctl, _("Node device %s created from %s\n"),
if (printXML) {
printf("%s", xml);
- free (xml);
+ VIR_FREE(xml);
} else {
pool = virStoragePoolCreateXML(ctl->conn, xml, 0);
- free (xml);
+ VIR_FREE(xml);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s created\n"), name);
return FALSE;
pool = virStoragePoolDefineXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined from %s\n"),
if (printXML) {
printf("%s", xml);
- free (xml);
+ VIR_FREE(xml);
} else {
pool = virStoragePoolDefineXML(ctl->conn, xml, 0);
- free (xml);
+ VIR_FREE(xml);
if (pool != NULL) {
vshPrint(ctl, _("Pool %s defined\n"), name);
dump = virStoragePoolGetXMLDesc(pool, 0);
if (dump != NULL) {
printf("%s", dump);
- free(dump);
+ VIR_FREE(dump);
} else {
ret = FALSE;
}
if ((maxactive = virConnectListStoragePools(ctl->conn, activeNames,
maxactive)) < 0) {
vshError(ctl, "%s", _("Failed to list active pools"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
maxinactive = virConnectNumOfDefinedStoragePools(ctl->conn);
if (maxinactive < 0) {
vshError(ctl, "%s", _("Failed to list inactive pools"));
- free(activeNames);
+ VIR_FREE(activeNames);
return FALSE;
}
if (maxinactive) {
if ((maxinactive = virConnectListDefinedStoragePools(ctl->conn, inactiveNames, maxinactive)) < 0) {
vshError(ctl, "%s", _("Failed to list inactive pools"));
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return FALSE;
}
/* this kind of work with pools is not atomic operation */
if (!pool) {
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
continue;
}
_("active"),
autostartStr);
virStoragePoolFree(pool);
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
}
for (i = 0; i < maxinactive; i++) {
virStoragePoolPtr pool = virStoragePoolLookupByName(ctl->conn, inactiveNames[i]);
/* this kind of work with pools is not atomic operation */
if (!pool) {
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
continue;
}
autostartStr);
virStoragePoolFree(pool);
- free(inactiveNames[i]);
+ VIR_FREE(inactiveNames[i]);
}
- free(activeNames);
- free(inactiveNames);
+ VIR_FREE(activeNames);
+ VIR_FREE(inactiveNames);
return TRUE;
}
}
srcList = virConnectFindStoragePoolSources(ctl->conn, type, srcSpec, 0);
- free(srcSpec);
+ VIR_FREE(srcSpec);
if (srcList == NULL) {
vshError(ctl, _("Failed to find any %s pool sources"), type);
return FALSE;
}
vshPrint(ctl, "%s", srcList);
- free(srcList);
+ VIR_FREE(srcList);
return TRUE;
}
return FALSE;
srcList = virConnectFindStoragePoolSources(ctl->conn, type, srcSpec, 0);
- free(srcSpec);
+ VIR_FREE(srcSpec);
if (srcList == NULL) {
vshError(ctl, _("Failed to find any %s pool sources"), type);
return FALSE;
}
vshPrint(ctl, "%s", srcList);
- free(srcList);
+ VIR_FREE(srcList);
return TRUE;
}
}
xml = virBufferContentAndReset(&buf);
vol = virStorageVolCreateXML(pool, xml, 0);
- free (xml);
+ VIR_FREE(xml);
virStoragePoolFree(pool);
if (vol != NULL) {
}
vol = virStorageVolCreateXML(pool, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
virStoragePoolFree(pool);
if (vol != NULL) {
ret = TRUE;
cleanup:
- free (buffer);
+ VIR_FREE(buffer);
if (pool)
virStoragePoolFree(pool);
if (inputvol)
ret = TRUE;
cleanup:
- free(origxml);
+ VIR_FREE(origxml);
xmlFree(newxml);
if (origvol)
virStorageVolFree(origvol);
dump = virStorageVolGetXMLDesc(vol, 0);
if (dump != NULL) {
printf("%s", dump);
- free(dump);
+ VIR_FREE(dump);
} else {
ret = FALSE;
}
if ((maxactive = virStoragePoolListVolumes(pool, activeNames,
maxactive)) < 0) {
vshError(ctl, "%s", _("Failed to list active vols"));
- free(activeNames);
+ VIR_FREE(activeNames);
virStoragePoolFree(pool);
return FALSE;
}
/* this kind of work with vols is not atomic operation */
if (!vol) {
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
continue;
}
vshPrint(ctl, "%-20s %-40s\n",
virStorageVolGetName(vol),
path);
- free(path);
+ VIR_FREE(path);
virStorageVolFree(vol);
- free(activeNames[i]);
+ VIR_FREE(activeNames[i]);
}
- free(activeNames);
+ VIR_FREE(activeNames);
virStoragePoolFree(pool);
return TRUE;
}
return FALSE;
res = virSecretDefineXML(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
if (res == NULL) {
vshError(ctl, _("Failed to set attributes from %s"), from);
if (xml == NULL)
goto cleanup;
printf("%s", xml);
- free(xml);
+ VIR_FREE(xml);
ret = TRUE;
cleanup:
res = virSecretSetValue(secret, (unsigned char *)value, value_size, 0);
memset(value, 0, value_size);
- free (value);
+ VIR_FREE(value);
if (res != 0) {
vshError(ctl, "%s", _("Failed to set secret value"));
base64_encode_alloc((char *)value, value_size, &base64);
memset(value, 0, value_size);
- free(value);
+ VIR_FREE(value);
if (base64 == NULL) {
vshError(ctl, "%s", _("Failed to allocate memory"));
}
printf("%s", base64);
memset(base64, 0, strlen(base64));
- free(base64);
+ VIR_FREE(base64);
ret = TRUE;
cleanup:
maxuuids = virConnectListSecrets(ctl->conn, uuids, maxuuids);
if (maxuuids < 0) {
vshError(ctl, "%s", _("Failed to list secrets"));
- free(uuids);
+ VIR_FREE(uuids);
return FALSE;
}
const char *usageType = NULL;
if (!sec) {
- free(uuids[i]);
+ VIR_FREE(uuids[i]);
continue;
}
uuids[i], _("Unused"));
}
virSecretFree(sec);
- free(uuids[i]);
+ VIR_FREE(uuids[i]);
}
- free(uuids);
+ VIR_FREE(uuids);
return TRUE;
}
virNodeListDevices(ctl->conn, cap, devices, num_devices, 0);
if (num_devices < 0) {
vshError(ctl, "%s", _("Failed to list node devices"));
- free(devices);
+ VIR_FREE(devices);
return FALSE;
}
qsort(&devices[0], num_devices, sizeof(char*), namesorter);
indentBuf);
}
for (i = 0 ; i < num_devices ; i++) {
- free(devices[i]);
- free(parents[i]);
+ VIR_FREE(devices[i]);
+ VIR_FREE(parents[i]);
}
- free(parents);
+ VIR_FREE(parents);
} else {
for (i = 0; i < num_devices; i++) {
vshPrint(ctl, "%s\n", devices[i]);
- free(devices[i]);
+ VIR_FREE(devices[i]);
}
}
- free(devices);
+ VIR_FREE(devices);
return TRUE;
}
}
vshPrint(ctl, "%s\n", xml);
- free(xml);
+ VIR_FREE(xml);
virNodeDeviceFree(device);
return TRUE;
}
}
vshPrint (ctl, "%s\n", hostname);
- free (hostname);
+ VIR_FREE(hostname);
return TRUE;
}
}
vshPrint (ctl, "%s\n", uri);
- free (uri);
+ VIR_FREE(uri);
return TRUE;
}
xml = xmlReadDoc((const xmlChar *) doc, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
- free(doc);
+ VIR_FREE(doc);
if (!xml)
goto cleanup;
ctxt = xmlXPathNewContext(xml);
xml = xmlReadDoc((const xmlChar *) doc, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
- free(doc);
+ VIR_FREE(doc);
if (!xml)
goto cleanup;
ctxt = xmlXPathNewContext(xml);
}
ret = virDomainAttachDevice(dom, buffer);
- free (buffer);
+ VIR_FREE(buffer);
if (ret < 0) {
vshError(ctl, _("Failed to attach device from %s"), from);
}
ret = virDomainDetachDevice(dom, buffer);
- free (buffer);
+ VIR_FREE(buffer);
if (ret < 0) {
vshError(ctl, _("Failed to detach device from %s"), from);
cleanup:
if (dom)
virDomainFree(dom);
- free(buf);
- free(tmp);
+ VIR_FREE(buf);
+ VIR_FREE(tmp);
return ret;
}
xml = xmlReadDoc((const xmlChar *) doc, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
- free(doc);
+ VIR_FREE(doc);
if (!xml) {
vshError(ctl, "%s", _("Failed to get interface information"));
goto cleanup;
cleanup:
if (dom)
virDomainFree(dom);
- free(buf);
- free(tmp);
+ VIR_FREE(buf);
+ VIR_FREE(tmp);
return ret;
}
xml = xmlReadDoc((const xmlChar *) doc, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
- free(doc);
+ VIR_FREE(doc);
if (!xml) {
vshError(ctl, "%s", _("Failed to get disk information"));
goto cleanup;
return FALSE;
result = virConnectCompareCPU(ctl->conn, buffer, 0);
- free (buffer);
+ VIR_FREE(buffer);
switch (result) {
case VIR_CPU_COMPARE_INCOMPATIBLE:
if (fd == -1) {
vshError(ctl, _("mkstemp: failed to create temporary file: %s"),
strerror(errno));
- free (ret);
+ VIR_FREE(ret);
return NULL;
}
ret, strerror(errno));
close (fd);
unlink (ret);
- free (ret);
+ VIR_FREE(ret);
return NULL;
}
if (close (fd) == -1) {
vshError(ctl, _("close: %s: failed to write or close temporary file: %s"),
ret, strerror(errno));
unlink (ret);
- free (ret);
+ VIR_FREE(ret);
return NULL;
}
if (command_ret == -1) {
vshError(ctl,
_("%s: edit command failed: %s"), command, strerror(errno));
- free (command);
+ VIR_FREE(command);
return -1;
}
if (command_ret != WEXITSTATUS (0)) {
vshError(ctl,
_("%s: command exited with non-zero status"), command);
- free (command);
+ VIR_FREE(command);
return -1;
}
- free (command);
+ VIR_FREE(command);
return 0;
}
else
vshPrint (ctl, _("%s\n"), cwd);
- free (cwd);
+ VIR_FREE(cwd);
return !err;
}
#endif
if (dom)
virDomainFree (dom);
- free (doc);
- free (doc_edited);
- free (doc_reread);
+ VIR_FREE(doc);
+ VIR_FREE(doc_edited);
+ VIR_FREE(doc_reread);
if (tmp) {
unlink (tmp);
- free (tmp);
+ VIR_FREE(tmp);
}
return ret;
a = a->next;
- free(tmp->data);
- free(tmp);
+ VIR_FREE(tmp->data);
+ VIR_FREE(tmp);
}
}
if (tmp->opts)
vshCommandOptFree(tmp->opts);
- free(tmp);
+ VIR_FREE(tmp);
}
}
if (arg->def && STREQ(arg->def->name, name)) {
char **tmp = realloc(val, sizeof(*tmp) * (nval+1));
if (!tmp) {
- free(val);
+ VIR_FREE(val);
return -1;
}
val = tmp;
vshError(ctl, _("unknown command: '%s'"), tkdata);
goto syntaxError; /* ... or ignore this command only? */
}
- free(tkdata);
- tkdata = NULL;
+ VIR_FREE(tkdata);
} else if (tk == VSH_TK_OPTION) {
if (!(opt = vshCmddefGetOption(cmd, tkdata))) {
vshError(ctl,
cmd->name, tkdata);
goto syntaxError;
}
- free(tkdata); /* option name */
- tkdata = NULL;
+ VIR_FREE(tkdata); /* option name */
if (opt->type != VSH_OT_BOOL) {
/* option data */
c->next = NULL;
if (!vshCommandCheckOpts(ctl, c)) {
- free(c);
+ VIR_FREE(c);
goto syntaxError;
}
vshCommandFree(ctl->cmd);
if (first)
vshCommandOptFree(first);
- free(tkdata);
+ VIR_FREE(tkdata);
return FALSE;
}
if ((x = realloc(ptr, size)))
return x;
- free(ptr);
+ VIR_FREE(ptr);
vshError(ctl, _("%s: %d: failed to allocate %d bytes"),
filename, line, (int) size);
exit(EXIT_FAILURE);
}
if (ctl->logfile) {
- free(ctl->logfile);
+ VIR_FREE(ctl->logfile);
ctl->logfile = NULL;
}
}
cmd = vshCmddefSearch(cmdname);
list_index = 0;
len = strlen(text);
- free(cmdname);
+ VIR_FREE(cmdname);
}
if (!cmd)
if (virAsprintf(&ctl->historydir, "%s/.virsh", userdir) < 0) {
vshError(ctl, "%s", _("Out of memory"));
- free(userdir);
+ VIR_FREE(userdir);
return -1;
}
if (virAsprintf(&ctl->historyfile, "%s/history", ctl->historydir) < 0) {
vshError(ctl, "%s", _("Out of memory"));
- free(userdir);
+ VIR_FREE(userdir);
return -1;
}
- free(userdir);
+ VIR_FREE(userdir);
read_history(ctl->historyfile);
write_history(ctl->historyfile);
}
- free(ctl->historydir);
- free(ctl->historyfile);
-
- ctl->historydir = NULL;
- ctl->historyfile = NULL;
+ VIR_FREE(ctl->historydir);
+ VIR_FREE(ctl->historyfile);
}
static char *
{
vshReadlineDeinit(ctl);
vshCloseLogFile(ctl);
- free(ctl->name);
+ VIR_FREE(ctl->name);
if (ctl->conn) {
if (virConnectClose(ctl->conn) != 0) {
vshError(ctl, "%s", _("failed to disconnect from the hypervisor"));
vshDebug(ctl, 2, "command: \"%s\"\n", cmdstr);
ret = vshCommandParse(ctl, cmdstr);
- free(cmdstr);
+ VIR_FREE(cmdstr);
return ret;
}
return TRUE;
if (vshCommandParse(ctl, ctl->cmdstr))
vshCommandRun(ctl, ctl->cmd);
}
- free(ctl->cmdstr);
- ctl->cmdstr = NULL;
+ VIR_FREE(ctl->cmdstr);
} while (ctl->imode);
if (ctl->cmdstr == NULL)