From 5407d095e6c66a5437234520db0252cd570c8d71 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Sat, 6 Oct 2018 11:12:08 +0200 Subject: [PATCH] cgfsng: use realloc instead of malloc+copy+free Signed-off-by: Wolfgang Bumiller --- src/lxc/cgroups/cgfsng.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 97913209c..71dfe72e6 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1377,10 +1377,9 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops, return bret; len = strlen(tmp) + 5; /* leave room for -NNN\0 */ - monitor_cgroup = must_alloc(len); - (void)strlcpy(monitor_cgroup, tmp, len); - free(tmp); + monitor_cgroup = must_realloc(tmp, len); offset = monitor_cgroup + len - 5; + *offset = 0; do { if (idx) { -- 2.47.2