[CRIU] [PATCH 2/8] libcriu: don't leak memory on error paths

Andrei Vagin avagin at openvz.org
Fri Feb 16 10:21:14 MSK 2018


[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

From: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 lib/c/criu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/c/criu.c b/lib/c/criu.c
index 84b7ad595..832a54d10 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -774,14 +774,14 @@ int criu_local_add_cg_dump_controller(criu_opts *opts, char *name)
        char **new, *ctrl_name;
        size_t nr;

-       ctrl_name = xstrdup(name);
+       ctrl_name = strdup(name);
        if (!ctrl_name)
                return -ENOMEM;

        nr = opts->rpc->n_cgroup_dump_controller + 1;
        new = realloc(opts->rpc->cgroup_dump_controller, nr * sizeof(char *));
        if (!new) {
-               xfree(ctrl_name);
+               free(ctrl_name);
                return -ENOMEM;
        }

--
2.13.6




More information about the CRIU mailing list