Do not use 'arg' which is later used for an allocated string.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tools/vsh.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 3bbaecd2ea..bf32a8dc22 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3199,17 +3199,16 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
char *str;
g_auto(virBuffer) xmlbuf = VIR_BUFFER_INITIALIZER;
-
- arg = opt->data;
+ const char *curr = opt->data;
if (count)
virBufferAddChar(&buf, ' ');
if (xml) {
- virBufferEscapeString(&xmlbuf, "%s", arg);
+ virBufferEscapeString(&xmlbuf, "%s", curr);
str = virBufferContentAndReset(&xmlbuf);
} else {
- str = g_strdup(arg);
+ str = g_strdup(curr);
}
if (shell)
--
2.31.1