{
virDomainGraphicsDef *graphics = NULL;
unsigned long port;
- char *listenAddr = NULL;
int val;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+ g_autofree char *listenAddr = NULL;
+
if (xenConfigGetBool(conf, "spice", &val, 0) < 0)
return -1;
goto cleanup;
if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0)
goto cleanup;
- VIR_FREE(listenAddr);
if (xenConfigGetULong(conf, "spicetls_port", &port, 0) < 0)
goto cleanup;
return 0;
cleanup:
- VIR_FREE(listenAddr);
virDomainGraphicsDefFree(graphics);
return -1;
}
static int
xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr)
{
- char *tmpstr = NULL;
int ret = -1;
/* A NULL source is valid, e.g. an empty CDROM */
return 0;
if (STRPREFIX(srcstr, "rbd:")) {
+ g_autofree char *tmpstr = NULL;
+
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
goto cleanup;
}
cleanup:
- VIR_FREE(tmpstr);
return ret;
}
{
virConfValue *list = virConfGetValue(conf, "channel");
virDomainChrDef *channel = NULL;
- char *name = NULL;
- char *path = NULL;
if (list && list->type == VIR_CONF_LIST) {
list = list->list;
while (list) {
g_autofree char *type = NULL;
+ g_autofree char *name = NULL;
+ g_autofree char *path = NULL;
char *key;
if ((list->type != VIR_CONF_STRING) || (list->str == NULL))
int len = nextkey ? (nextkey - data) : strlen(data);
g_clear_pointer(&type, g_free);
type = g_strndup(data, len);
- } else if (STRPREFIX(key, "name=")) {
+ } else if (!name && STRPREFIX(key, "name=")) {
int len = nextkey ? (nextkey - data) : strlen(data);
- VIR_FREE(name);
name = g_strndup(data, len);
- } else if (STRPREFIX(key, "path=")) {
+ } else if (!path && STRPREFIX(key, "path=")) {
int len = nextkey ? (nextkey - data) : strlen(data);
- VIR_FREE(path);
path = g_strndup(data, len);
}
channel->source->data.nix.path = g_steal_pointer(&path);
} else if (STRPREFIX(type, "pty")) {
channel->source->type = VIR_DOMAIN_CHR_TYPE_PTY;
- VIR_FREE(path);
} else {
goto cleanup;
}
cleanup:
virDomainChrDefFree(channel);
- VIR_FREE(path);
- VIR_FREE(name);
return -1;
}
list->list = numaVnode;
ret = 0;
- VIR_FREE(nodeVcpus);
return ret;
}