mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-25 02:58:54 +00:00
libcriu: criu_init_opts: don't leak on rpc and opts
Reported-by: Andrew Vagin <avagin@gmail.com> Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ba68d61f54
commit
de17028a08
1 changed files with 8 additions and 2 deletions
10
lib/criu.c
10
lib/criu.c
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue