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
2c6c514a
Unverified
Commit
2c6c514a
authored
Dec 09, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile_utils: cleanup lxc_network_add()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5207b430
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
confile_utils.c
src/lxc/confile_utils.c
+7
-8
No files found.
src/lxc/confile_utils.c
View file @
2c6c514a
...
@@ -160,13 +160,13 @@ bool lxc_config_value_empty(const char *value)
...
@@ -160,13 +160,13 @@ bool lxc_config_value_empty(const char *value)
struct
lxc_netdev
*
lxc_network_add
(
struct
lxc_list
*
networks
,
int
idx
,
bool
tail
)
struct
lxc_netdev
*
lxc_network_add
(
struct
lxc_list
*
networks
,
int
idx
,
bool
tail
)
{
{
struct
lxc_list
*
newlist
;
__do_free
struct
lxc_list
*
newlist
=
NULL
;
struct
lxc_netdev
*
netdev
=
NULL
;
__do_free
struct
lxc_netdev
*
netdev
=
NULL
;
/* network does not exist */
/* network does not exist */
netdev
=
malloc
(
sizeof
(
*
netdev
));
netdev
=
malloc
(
sizeof
(
*
netdev
));
if
(
!
netdev
)
if
(
!
netdev
)
return
NULL
;
return
ret_set_errno
(
NULL
,
ENOMEM
)
;
memset
(
netdev
,
0
,
sizeof
(
*
netdev
));
memset
(
netdev
,
0
,
sizeof
(
*
netdev
));
lxc_list_init
(
&
netdev
->
ipv4
);
lxc_list_init
(
&
netdev
->
ipv4
);
...
@@ -177,10 +177,8 @@ struct lxc_netdev *lxc_network_add(struct lxc_list *networks, int idx, bool tail
...
@@ -177,10 +177,8 @@ struct lxc_netdev *lxc_network_add(struct lxc_list *networks, int idx, bool tail
/* prepare new list */
/* prepare new list */
newlist
=
malloc
(
sizeof
(
*
newlist
));
newlist
=
malloc
(
sizeof
(
*
newlist
));
if
(
!
newlist
)
{
if
(
!
newlist
)
free
(
netdev
);
return
ret_set_errno
(
NULL
,
ENOMEM
);
return
NULL
;
}
lxc_list_init
(
newlist
);
lxc_list_init
(
newlist
);
newlist
->
elem
=
netdev
;
newlist
->
elem
=
netdev
;
...
@@ -189,8 +187,9 @@ struct lxc_netdev *lxc_network_add(struct lxc_list *networks, int idx, bool tail
...
@@ -189,8 +187,9 @@ struct lxc_netdev *lxc_network_add(struct lxc_list *networks, int idx, bool tail
lxc_list_add_tail
(
networks
,
newlist
);
lxc_list_add_tail
(
networks
,
newlist
);
else
else
lxc_list_add
(
networks
,
newlist
);
lxc_list_add
(
networks
,
newlist
);
move_ptr
(
newlist
);
return
netdev
;
return
move_ptr
(
netdev
)
;
}
}
/* Takes care of finding the correct netdev struct in the networks list or
/* Takes care of finding the correct netdev struct in the networks list or
...
...
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