{
char *configFile = NULL;
char *autostartLink = NULL;
+ int ret = -1;
if ((configFile = virNetworkConfigFile(conn, configDir, net->def->name)) == NULL)
goto error;
goto error;
}
- return 0;
+ ret = 0;
error:
VIR_FREE(configFile);
VIR_FREE(autostartLink);
- return -1;
+ return ret;
}
char *virNetworkConfigFile(virConnectPtr conn,
virDomainNetDefPtr net,
int qemuCmdFlags)
{
- char *brname;
+ char *brname = NULL;
int err;
int tapfd = -1;
int vnet_hdr = 0;
if (brname == NULL)
return -1;
} else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
- brname = net->data.bridge.brname;
+ brname = strdup(net->data.bridge.brname);
} else {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("Network type %d is not supported"), net->type);
if (!driver->brctl && (err = brInit(&driver->brctl))) {
virReportSystemError(conn, err, "%s",
_("cannot initialize bridge support"));
- return -1;
+ goto cleanup;
}
if (!net->ifname ||
VIR_FREE(net->ifname);
if (!(net->ifname = strdup("vnet%d"))) {
virReportOOMError(conn);
- return -1;
+ goto cleanup;
}
/* avoid exposing vnet%d in dumpxml or error outputs */
template_ifname = 1;
}
if (template_ifname)
VIR_FREE(net->ifname);
- return -1;
+ tapfd = -1;
}
+cleanup:
+ VIR_FREE(brname);
+
return tapfd;
}
vol->type = VIR_STORAGE_VOL_FILE;
+ VIR_FREE(vol->target.path);
if (virAsprintf(&vol->target.path, "%s/%s",
pool->def->target.path,
vol->name) == -1) {
return -1;
}
+ VIR_FREE(vol->key);
vol->key = strdup(vol->target.path);
if (vol->key == NULL) {
virReportOOMError(conn);