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
e07eafa8
Commit
e07eafa8
authored
Apr 24, 2018
by
LiFeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak in list_active_containers
Signed-off-by:
LiFeng
<
lifeng68@huawei.com
>
parent
71cb9afb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
lxccontainer.c
src/lxc/lxccontainer.c
+21
-4
No files found.
src/lxc/lxccontainer.c
View file @
e07eafa8
...
...
@@ -4973,32 +4973,49 @@ int list_active_containers(const char *lxcpath, char ***nret,
char
*
recvpath
=
lxc_cmd_get_lxcpath
(
p
);
if
(
!
recvpath
)
continue
;
if
(
strncmp
(
lxcpath
,
recvpath
,
lxcpath_len
)
!=
0
)
if
(
strncmp
(
lxcpath
,
recvpath
,
lxcpath_len
)
!=
0
)
{
free
(
recvpath
);
continue
;
}
free
(
recvpath
);
p
=
lxc_cmd_get_name
(
p
);
if
(
!
p
)
continue
;
}
if
(
array_contains
(
&
ct_name
,
p
,
ct_name_cnt
))
if
(
array_contains
(
&
ct_name
,
p
,
ct_name_cnt
))
{
if
(
is_hashed
)
free
(
p
);
continue
;
}
if
(
!
add_to_array
(
&
ct_name
,
p
,
ct_name_cnt
))
if
(
!
add_to_array
(
&
ct_name
,
p
,
ct_name_cnt
))
{
if
(
is_hashed
)
free
(
p
);
goto
free_cret_list
;
}
ct_name_cnt
++
;
if
(
!
cret
)
if
(
!
cret
)
{
if
(
is_hashed
)
free
(
p
);
continue
;
}
c
=
lxc_container_new
(
p
,
lxcpath
);
if
(
!
c
)
{
INFO
(
"Container %s:%s is running but could not be loaded"
,
lxcpath
,
p
);
remove_from_array
(
&
ct_name
,
p
,
ct_name_cnt
--
);
if
(
is_hashed
)
free
(
p
);
continue
;
}
if
(
is_hashed
)
free
(
p
);
/*
* If this is an anonymous container, then is_defined *can*
* return false. So we don't do that check. Count on the
...
...
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