virBufferAddLit(buf," <source>\n");
if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->nhost) {
for (i = 0; i < src->nhost; i++) {
- virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name);
+ virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name);
if (src->hosts[i].port)
virBufferAsprintf(buf, " port='%d'", src->hosts[i].port);
virBufferAddLit(buf, "/>\n");
/*
* storage_backend_iscsi.c: storage backend for iSCSI handling
*
- * Copyright (C) 2007-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010-2012 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
}
for (i = 0 ; i < ntargets ; i++) {
- if (VIR_ALLOC_N(list.sources[i].devices, 1) < 0) {
+ if (VIR_ALLOC_N(list.sources[i].devices, 1) < 0 ||
+ VIR_ALLOC_N(list.sources[i].hosts, 1) < 0) {
virReportOOMError();
goto cleanup;
}
- list.sources[i].host = source->hosts[0];
+ list.sources[i].nhost = 1;
+ list.sources[i].hosts[0] = source->hosts[0];
list.sources[i].initiator = source->initiator;
list.sources[i].ndevice = 1;
list.sources[i].devices[0].path = targets[i];
cleanup:
if (list.sources) {
- for (i = 0 ; i < ntargets ; i++)
+ for (i = 0 ; i < ntargets ; i++) {
+ VIR_FREE(list.sources[i].hosts);
VIR_FREE(list.sources[i].devices);
+ }
VIR_FREE(list.sources);
}
for (i = 0 ; i < ntargets ; i++)