Make sure to not skip any of the created server, and to always free
the "server" array.
diff --git a/src/drives.c b/src/drives.c
index 4bd8328..85c1495 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs,
for (i = 0; i < n; ++i) {
if (parse_one_server (g, strs[i], &servers[i]) == -1) {
- if (i > 0)
- free_drive_servers (servers, i-1);
+ free_drive_servers (servers, i);
return -1;
}
}
---
src/drives.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/drives.c b/src/drives.c
index 4bd8328..85c1495 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs,
for (i = 0; i < n; ++i) {
if (parse_one_server (g, strs[i], &servers[i]) == -1) {
- if (i > 0)
- free_drive_servers (servers, i-1);
+ free_drive_servers (servers, i);
return -1;
}
}
--
1.9.3