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
4c7de7c5
Unverified
Commit
4c7de7c5
authored
Mar 31, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc_user_nic: cleanup append_alloted()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b405dec6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
lxc_user_nic.c
src/lxc/cmd/lxc_user_nic.c
+12
-15
No files found.
src/lxc/cmd/lxc_user_nic.c
View file @
4c7de7c5
...
...
@@ -233,10 +233,10 @@ struct alloted_s {
struct
alloted_s
*
next
;
};
static
struct
alloted_s
*
append_alloted
(
struct
alloted_s
**
head
,
char
*
name
,
int
n
)
static
struct
alloted_s
*
append_alloted
(
struct
alloted_s
**
head
,
char
*
name
,
int
n
)
{
struct
alloted_s
*
cur
,
*
al
;
__do_free
struct
alloted_s
*
al
=
NULL
;
struct
alloted_s
*
cur
;
if
(
!
head
||
!
name
)
{
/* Sanity check. Parameters should not be null. */
...
...
@@ -244,32 +244,29 @@ static struct alloted_s *append_alloted(struct alloted_s **head, char *name,
return
NULL
;
}
al
=
m
alloc
(
sizeof
(
struct
alloted_s
));
al
=
z
alloc
(
sizeof
(
struct
alloted_s
));
if
(
!
al
)
{
CMD_SYSERROR
(
"Failed to allocate memory
\n
"
);
return
NULL
;
}
al
->
name
=
strdup
(
name
);
if
(
!
al
->
name
)
{
free
(
al
);
if
(
!
al
->
name
)
return
NULL
;
}
al
->
allowed
=
n
;
al
->
next
=
NULL
;
if
(
!*
head
)
{
if
(
*
head
)
{
cur
=
*
head
;
while
(
cur
->
next
)
cur
=
cur
->
next
;
cur
->
next
=
al
;
}
else
{
*
head
=
al
;
return
al
;
}
cur
=
*
head
;
while
(
cur
->
next
)
cur
=
cur
->
next
;
cur
->
next
=
al
;
return
al
;
return
move_ptr
(
al
);
}
static
void
free_alloted
(
struct
alloted_s
**
head
)
...
...
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