Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/lxc/lxc_container.c | 4 +---
src/lxc/lxc_controller.c | 3 +--
src/lxc/lxc_driver.c | 2 +-
src/lxc/lxc_fuse.c | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c22b7b0709..24a3b6d626 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -174,7 +174,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
virCommandPtr cmd;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
/* 'container_ptys' must exclude the PTY associated with
@@ -185,7 +185,6 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Expected a /dev path for '%s'"),
ttyPaths[i]);
- virBufferFreeAndReset(&buf);
return NULL;
}
virBufferAdd(&buf, ttyPaths[i] + 5, -1);
@@ -219,7 +218,6 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
vmDef->os.initenv[i]->value);
}
- virBufferFreeAndReset(&buf);
return cmd;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 89f9773b2c..01cdeb29db 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1378,7 +1378,7 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map,
int num,
char *path)
{
- virBuffer map_value = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) map_value = VIR_BUFFER_INITIALIZER;
size_t i;
int ret = -1;
@@ -1402,7 +1402,6 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map,
ret = 0;
cleanup:
- virBufferFreeAndReset(&map_value);
return ret;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 46a182be45..1cdd6ee455 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4618,7 +4618,7 @@ static char *
lxcConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
{
virLXCDriverPtr driver = conn->privateData;
- virBuffer buf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCheckFlags(0, NULL);
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 146629f67e..6e23361617 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -124,7 +124,7 @@ static int lxcProcReadMeminfo(char *hostpath, virDomainDefPtr def,
g_autofree char *line = NULL;
size_t n;
struct virLXCMeminfo meminfo;
- virBuffer buffer = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) buffer = VIR_BUFFER_INITIALIZER;
virBufferPtr new_meminfo = &buffer;
if (virLXCCgroupGetMeminfo(&meminfo) < 0) {
@@ -223,7 +223,6 @@ static int lxcProcReadMeminfo(char *hostpath, virDomainDefPtr def,
memcpy(buf, virBufferCurrentContent(new_meminfo), res);
cleanup:
- virBufferFreeAndReset(new_meminfo);
VIR_FORCE_FCLOSE(fd);
return res;
}
--
2.25.4