Switch to using the 'g_auto*' helpers.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/util/virconf.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 16107bce96..11046a1d45 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1505,26 +1505,19 @@ virConfLoadConfigPath(const char *name)
int
virConfLoadConfig(virConfPtr *conf, const char *name)
{
- char *path = NULL;
- int ret = -1;
+ g_autofree char *path = NULL;
*conf = NULL;
if (!(path = virConfLoadConfigPath(name)))
- goto cleanup;
+ return -1;
- if (!virFileExists(path)) {
- ret = 0;
- goto cleanup;
- }
+ if (!virFileExists(path))
+ return 0;
VIR_DEBUG("Loading config file '%s'", path);
if (!(*conf = virConfReadFile(path, 0)))
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- VIR_FREE(path);
- return ret;
+ return 0;
}
--
2.25.3