Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/esx/esx_driver.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e82e5ed835..0798493296 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -813,7 +813,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
esxPrivate *priv = NULL;
char *potentialVCenterIPAddress = NULL;
- char vCenterIPAddress[NI_MAXHOST] = "";
+ g_autofree char *vCenterIPAddress = g_new0(char, NI_MAXHOST);
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
@@ -875,8 +875,9 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
goto cleanup;
}
- if (virStrcpyStatic(vCenterIPAddress,
- potentialVCenterIPAddress) < 0) {
+ if (virStrcpy(vCenterIPAddress,
+ potentialVCenterIPAddress,
+ NI_MAXHOST) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("vCenter IP address %s too big for
destination"),
potentialVCenterIPAddress);
--
2.26.2