const char *type;
qemuEventHandler *handler;
virJSONValue *data;
- char *details = NULL;
+ g_autofree char *details = NULL;
virJSONValue *timestamp;
long long seconds = -1;
unsigned int micros = 0;
µs));
}
qemuMonitorEmitEvent(mon, type, seconds, micros, details);
- VIR_FREE(details);
handler = bsearch(type, eventHandlers, G_N_ELEMENTS(eventHandlers),
sizeof(eventHandlers[0]), qemuMonitorEventCompare);
if (nl) {
int got = nl - (data + used);
- char *line;
- line = g_strndup(data + used, got);
+ g_autofree char *line = g_strndup(data + used, got);
+
used += got + strlen(LINE_ENDING);
line[got] = '\0'; /* kill \n */
- if (qemuMonitorJSONIOProcessLine(mon, line, msg) < 0) {
- VIR_FREE(line);
+ if (qemuMonitorJSONIOProcessLine(mon, line, msg) < 0)
return -1;
- }
-
- VIR_FREE(line);
} else {
break;
}
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValue *caps;
- virGICCapability *list = NULL;
+ g_autofree virGICCapability *list = NULL;
size_t i;
size_t n;
*capabilities = g_steal_pointer(&list);
cleanup:
- VIR_FREE(list);
-
return ret;
}
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) addr = NULL;
- char *port_str = NULL;
+ g_autofree char *port_str = NULL;
switch ((virStorageNetHostTransport)server->transport) {
case VIR_STORAGE_NET_HOST_TRANS_TCP:
ret = 0;
cleanup:
- VIR_FREE(port_str);
return ret;
}
const char *backend_type = NULL;
const char *host;
const char *port;
- char *tlsalias = NULL;
+ g_autofree char *tlsalias = NULL;
bool telnet;
switch ((virDomainChrType)chr->type) {
goto cleanup;
cleanup:
- VIR_FREE(tlsalias);
return ret;
}
qemuMonitorIOThreadInfo *iothreadInfo)
{
int ret = -1;
- char *path = NULL;
+ g_autofree char *path = NULL;
qemuMonitorJSONObjectProperty prop;
path = g_strdup_printf("/objects/iothread%u", iothreadInfo->iothread_id);
ret = 0;
cleanup:
- VIR_FREE(path);
return ret;
}
char **path)
{
qemuMonitorJSONListPath **paths = NULL;
- char *child = NULL;
+ g_autofree char *child = NULL;
int npaths;
int ret = -1;
size_t i;
for (i = 0; i < npaths; i++)
qemuMonitorJSONListPathFree(paths[i]);
VIR_FREE(paths);
- VIR_FREE(child);
return ret;
}
{
ssize_t i, npaths = 0;
int ret = -2;
- char *nextpath = NULL;
qemuMonitorJSONListPath **paths = NULL;
VIR_DEBUG("Searching for '%s' Object Path starting at '%s'", name, curpath);
* traversed looking for more entries
*/
if (paths[i]->type && STRPREFIX(paths[i]->type, "child<")) {
- nextpath = g_strdup_printf("%s/%s", curpath, paths[i]->name);
+ g_autofree char *nextpath = g_strdup_printf("%s/%s", curpath, paths[i]->name);
ret = qemuMonitorJSONFindObjectPathByName(mon, nextpath, name, path);
- VIR_FREE(nextpath);
}
}
for (i = 0; i < npaths; i++)
qemuMonitorJSONListPathFree(paths[i]);
VIR_FREE(paths);
- VIR_FREE(nextpath);
return ret;
}
const char *alias,
char **path)
{
- char *linkname = NULL;
+ g_autofree char *linkname = NULL;
int ret = -1;
if (alias) {
linkname = g_strdup_printf("link<%s>", name);
ret = qemuMonitorJSONFindObjectPathByName(mon, "/", linkname, path);
- VIR_FREE(linkname);
return ret;
}