mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 05:59:00 +00:00
Merge pull request #2673 from Blub/2018-10-06/cgfsng-alloc-cleanup
cgfsng: use realloc instead of malloc+copy+free
This commit is contained in:
commit
13c45a4a9d
@ -1377,10 +1377,9 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
|
|||||||
return bret;
|
return bret;
|
||||||
|
|
||||||
len = strlen(tmp) + 5; /* leave room for -NNN\0 */
|
len = strlen(tmp) + 5; /* leave room for -NNN\0 */
|
||||||
monitor_cgroup = must_alloc(len);
|
monitor_cgroup = must_realloc(tmp, len);
|
||||||
(void)strlcpy(monitor_cgroup, tmp, len);
|
|
||||||
free(tmp);
|
|
||||||
offset = monitor_cgroup + len - 5;
|
offset = monitor_cgroup + len - 5;
|
||||||
|
*offset = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (idx) {
|
if (idx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user