Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
776bb08b
Unverified
Commit
776bb08b
authored
Jun 11, 2018
by
Donghwa Jeong
Committed by
Christian Brauner
Dec 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: #1425781
Resource leak Signed-off-by:
Donghwa Jeong
<
dh48.jeong@samsung.com
>
parent
3a15f35b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
criu.c
src/lxc/criu.c
+19
-6
No files found.
src/lxc/criu.c
View file @
776bb08b
...
@@ -769,14 +769,14 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
...
@@ -769,14 +769,14 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
{
{
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
if
(
!
criu_version_ok
(
criu_version
))
return
false
;
if
(
geteuid
())
{
if
(
geteuid
())
{
ERROR
(
"Must be root to checkpoint"
);
ERROR
(
"Must be root to checkpoint"
);
return
false
;
return
false
;
}
}
if
(
!
criu_version_ok
(
criu_version
))
return
false
;
/* We only know how to restore containers with veth networks. */
/* We only know how to restore containers with veth networks. */
lxc_list_for_each
(
it
,
&
c
->
lxc_conf
->
network
)
{
lxc_list_for_each
(
it
,
&
c
->
lxc_conf
->
network
)
{
struct
lxc_netdev
*
n
=
it
->
elem
;
struct
lxc_netdev
*
n
=
it
->
elem
;
...
@@ -788,6 +788,10 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
...
@@ -788,6 +788,10 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
break
;
break
;
default:
default:
ERROR
(
"Found un-dumpable network: %s (%s)"
,
lxc_net_type_to_str
(
n
->
type
),
n
->
name
);
ERROR
(
"Found un-dumpable network: %s (%s)"
,
lxc_net_type_to_str
(
n
->
type
),
n
->
name
);
if
(
criu_version
)
{
free
(
*
criu_version
);
*
criu_version
=
NULL
;
}
return
false
;
return
false
;
}
}
}
}
...
@@ -1139,6 +1143,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
...
@@ -1139,6 +1143,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
ret
=
pipe
(
criuout
);
ret
=
pipe
(
criuout
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"pipe() failed"
);
SYSERROR
(
"pipe() failed"
);
free
(
criu_version
);
return
false
;
return
false
;
}
}
...
@@ -1194,6 +1199,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
...
@@ -1194,6 +1199,7 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
if
(
w
==
-
1
)
{
if
(
w
==
-
1
)
{
SYSERROR
(
"waitpid"
);
SYSERROR
(
"waitpid"
);
close
(
criuout
[
0
]);
close
(
criuout
[
0
]);
free
(
criu_version
);
return
false
;
return
false
;
}
}
...
@@ -1222,6 +1228,8 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
...
@@ -1222,6 +1228,8 @@ static bool do_dump(struct lxc_container *c, char *mode, struct migrate_opts *op
if
(
!
ret
)
if
(
!
ret
)
ERROR
(
"criu output: %s"
,
buf
);
ERROR
(
"criu output: %s"
,
buf
);
free
(
criu_version
);
return
ret
;
return
ret
;
}
}
fail:
fail:
...
@@ -1261,9 +1269,6 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
...
@@ -1261,9 +1269,6 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
int
pipefd
[
2
];
int
pipefd
[
2
];
char
*
criu_version
=
NULL
;
char
*
criu_version
=
NULL
;
if
(
!
criu_ok
(
c
,
&
criu_version
))
return
false
;
if
(
geteuid
())
{
if
(
geteuid
())
{
ERROR
(
"Must be root to restore"
);
ERROR
(
"Must be root to restore"
);
return
false
;
return
false
;
...
@@ -1274,10 +1279,17 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
...
@@ -1274,10 +1279,17 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
return
false
;
return
false
;
}
}
if
(
!
criu_ok
(
c
,
&
criu_version
))
{
close
(
pipefd
[
0
]);
close
(
pipefd
[
1
]);
return
false
;
}
pid
=
fork
();
pid
=
fork
();
if
(
pid
<
0
)
{
if
(
pid
<
0
)
{
close
(
pipefd
[
0
]);
close
(
pipefd
[
0
]);
close
(
pipefd
[
1
]);
close
(
pipefd
[
1
]);
free
(
criu_version
);
return
false
;
return
false
;
}
}
...
@@ -1288,6 +1300,7 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
...
@@ -1288,6 +1300,7 @@ bool __criu_restore(struct lxc_container *c, struct migrate_opts *opts)
}
}
close
(
pipefd
[
1
]);
close
(
pipefd
[
1
]);
free
(
criu_version
);
nread
=
read
(
pipefd
[
0
],
&
status
,
sizeof
(
status
));
nread
=
read
(
pipefd
[
0
],
&
status
,
sizeof
(
status
));
close
(
pipefd
[
0
]);
close
(
pipefd
[
0
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment