提交 dd478cc5 编写于 作者: F Fabiano Fidêncio

tools: Use g_autofree in cmdCd()

Signed-off-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 330b5568
......@@ -3175,8 +3175,7 @@ bool
cmdCd(vshControl *ctl, const vshCmd *cmd)
{
const char *dir = NULL;
char *dir_malloced = NULL;
bool ret = true;
g_autofree char *dir_malloced = NULL;
char ebuf[1024];
if (!ctl->imode) {
......@@ -3192,11 +3191,10 @@ cmdCd(vshControl *ctl, const vshCmd *cmd)
if (chdir(dir) == -1) {
vshError(ctl, _("cd: %s: %s"),
virStrerror(errno, ebuf, sizeof(ebuf)), dir);
ret = false;
return false;
}
VIR_FREE(dir_malloced);
return ret;
return true;
}
const vshCmdOptDef opts_echo[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册