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
bf83c5b9
Commit
bf83c5b9
authored
Mar 19, 2011
by
Michael Santos
Committed by
Daniel Lezcano
Mar 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: check allocation succeeds
Signed-off-by:
Michael Santos
<
michael.santos@gmail.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
95642a10
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
confile.c
src/lxc/confile.c
+29
-8
No files found.
src/lxc/confile.c
View file @
bf83c5b9
...
@@ -195,7 +195,7 @@ static struct lxc_netdev *network_netdev(const char *key, const char *value,
...
@@ -195,7 +195,7 @@ static struct lxc_netdev *network_netdev(const char *key, const char *value,
static
int
network_ifname
(
char
**
valuep
,
char
*
value
)
static
int
network_ifname
(
char
**
valuep
,
char
*
value
)
{
{
if
(
strlen
(
value
)
>
IFNAMSIZ
)
{
if
(
strlen
(
value
)
>
=
IFNAMSIZ
)
{
ERROR
(
"invalid interface name: %s"
,
value
);
ERROR
(
"invalid interface name: %s"
,
value
);
return
-
1
;
return
-
1
;
}
}
...
@@ -553,8 +553,8 @@ static int config_cgroup(const char *key, char *value, struct lxc_conf *lxc_conf
...
@@ -553,8 +553,8 @@ static int config_cgroup(const char *key, char *value, struct lxc_conf *lxc_conf
{
{
char
*
token
=
"lxc.cgroup."
;
char
*
token
=
"lxc.cgroup."
;
char
*
subkey
;
char
*
subkey
;
struct
lxc_list
*
cglist
;
struct
lxc_list
*
cglist
=
NULL
;
struct
lxc_cgroup
*
cgelem
;
struct
lxc_cgroup
*
cgelem
=
NULL
;
subkey
=
strstr
(
key
,
token
);
subkey
=
strstr
(
key
,
token
);
...
@@ -571,21 +571,40 @@ static int config_cgroup(const char *key, char *value, struct lxc_conf *lxc_conf
...
@@ -571,21 +571,40 @@ static int config_cgroup(const char *key, char *value, struct lxc_conf *lxc_conf
cglist
=
malloc
(
sizeof
(
*
cglist
));
cglist
=
malloc
(
sizeof
(
*
cglist
));
if
(
!
cglist
)
if
(
!
cglist
)
return
-
1
;
goto
out
;
cgelem
=
malloc
(
sizeof
(
*
cgelem
));
cgelem
=
malloc
(
sizeof
(
*
cgelem
));
if
(
!
cgelem
)
{
if
(
!
cgelem
)
free
(
cglist
);
goto
out
;
return
-
1
;
memset
(
cgelem
,
0
,
sizeof
(
*
cgelem
));
}
cgelem
->
subsystem
=
strdup
(
subkey
);
cgelem
->
subsystem
=
strdup
(
subkey
);
cgelem
->
value
=
strdup
(
value
);
cgelem
->
value
=
strdup
(
value
);
if
(
!
cgelem
->
subsystem
||
!
cgelem
->
value
)
goto
out
;
cglist
->
elem
=
cgelem
;
cglist
->
elem
=
cgelem
;
lxc_list_add_tail
(
&
lxc_conf
->
cgroup
,
cglist
);
lxc_list_add_tail
(
&
lxc_conf
->
cgroup
,
cglist
);
return
0
;
return
0
;
out:
if
(
cglist
)
free
(
cglist
);
if
(
cgelem
)
{
if
(
cgelem
->
subsystem
)
free
(
cgelem
->
subsystem
);
if
(
cgelem
->
value
)
free
(
cgelem
->
value
);
free
(
cgelem
);
}
return
-
1
;
}
}
static
int
config_fstab
(
const
char
*
key
,
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
static
int
config_fstab
(
const
char
*
key
,
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
...
@@ -631,6 +650,8 @@ static int config_mount(const char *key, char *value, struct lxc_conf *lxc_conf)
...
@@ -631,6 +650,8 @@ static int config_mount(const char *key, char *value, struct lxc_conf *lxc_conf)
return
-
1
;
return
-
1
;
mntelem
=
strdup
(
value
);
mntelem
=
strdup
(
value
);
if
(
!
mntelem
)
return
-
1
;
mntlist
->
elem
=
mntelem
;
mntlist
->
elem
=
mntelem
;
lxc_list_add_tail
(
&
lxc_conf
->
mount_list
,
mntlist
);
lxc_list_add_tail
(
&
lxc_conf
->
mount_list
,
mntlist
);
...
...
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