Commit de17028a authored by Ruslan Kuprieiev's avatar Ruslan Kuprieiev Committed by Pavel Emelyanov

libcriu: criu_init_opts: don't leak on rpc and opts

Reported-by: 's avatarAndrew Vagin <avagin@gmail.com>
Signed-off-by: 's avatarRuslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ba68d61f
......@@ -61,8 +61,13 @@ int criu_local_init_opts(criu_opts **o)
opts = *o;
if (opts && opts->rpc)
criu_opts__free_unpacked(opts->rpc, NULL);
if (opts) {
if (opts->rpc)
criu_opts__free_unpacked(opts->rpc, NULL);
free(opts);
opts = NULL;
}
rpc = malloc(sizeof(CriuOpts));
if (rpc == NULL) {
......@@ -75,6 +80,7 @@ int criu_local_init_opts(criu_opts **o)
opts = malloc(sizeof(criu_opts));
if (opts == NULL) {
perror("Can't allocate memory for criu opts");
criu_opts__free_unpacked(rpc, NULL);
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment