Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/storage/storage_backend_iscsi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index e4fa49d05f..01900f6809 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -283,10 +283,8 @@ virStorageBackendISCSISetAuth(const char *portal,
&secret_value, &secret_size) < 0)
return -1;
- secret_str = g_new0(char, secret_size + 1);
- memcpy(secret_str, secret_value, secret_size);
+ secret_str = g_strndup((char *) secret_value, secret_size);
virSecureErase(secret_value, secret_size);
- secret_str[secret_size] = '\0';
if (virISCSINodeUpdate(portal,
source->devices[0].path,
--
2.39.1