提交 1ee7294b 编写于 作者: J John Ferlan

storage: Cleanup virStorageFileBackendGlusterReadlinkCallback

Rather than having two exit paths, let's use a @retval value
and VIR_STEAL_PTR in order to unite the exit path through the
error label.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 9916f2a3
......@@ -262,6 +262,7 @@ virStorageFileBackendGlusterReadlinkCallback(const char *path,
size_t bufsiz = 0;
ssize_t ret;
struct stat st;
int retval = -1;
*linkpath = NULL;
......@@ -291,13 +292,13 @@ virStorageFileBackendGlusterReadlinkCallback(const char *path,
buf[ret] = '\0';
*linkpath = buf;
VIR_STEAL_PTR(*linkpath, buf);
return 0;
retval = 0;
error:
VIR_FREE(buf);
return -1;
return retval;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册