From: Wolfgang Bumiller Date: Sat, 6 Oct 2018 09:12:08 +0000 (+0200) Subject: cgfsng: use realloc instead of malloc+copy+free X-Git-Tag: lxc-3.1.0~64^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2673%2Fhead;p=thirdparty%2Flxc.git cgfsng: use realloc instead of malloc+copy+free Signed-off-by: Wolfgang Bumiller --- 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) {