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
53719062
Commit
53719062
authored
Apr 14, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix coverity-found resource leaks on error paths.
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
28027320
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
confile.c
src/lxc/confile.c
+9
-0
No files found.
src/lxc/confile.c
View file @
53719062
...
...
@@ -611,6 +611,7 @@ static int config_network_ipv4(const char *key, const char *value,
list
=
malloc
(
sizeof
(
*
list
));
if
(
!
list
)
{
SYSERROR
(
"failed to allocate memory"
);
free
(
inetdev
);
return
-
1
;
}
...
...
@@ -620,6 +621,8 @@ static int config_network_ipv4(const char *key, const char *value,
addr
=
strdup
(
value
);
if
(
!
addr
)
{
ERROR
(
"no address specified"
);
free
(
inetdev
);
free
(
list
);
return
-
1
;
}
...
...
@@ -637,12 +640,16 @@ static int config_network_ipv4(const char *key, const char *value,
if
(
!
inet_pton
(
AF_INET
,
addr
,
&
inetdev
->
addr
))
{
SYSERROR
(
"invalid ipv4 address: %s"
,
value
);
free
(
inetdev
);
free
(
addr
);
free
(
list
);
return
-
1
;
}
if
(
bcast
&&
!
inet_pton
(
AF_INET
,
bcast
,
&
inetdev
->
bcast
))
{
SYSERROR
(
"invalid ipv4 broadcast address: %s"
,
value
);
free
(
inetdev
);
free
(
list
);
free
(
addr
);
return
-
1
;
}
...
...
@@ -684,6 +691,7 @@ static int config_network_ipv4_gateway(const char *key, const char *value,
if
(
!
value
)
{
ERROR
(
"no ipv4 gateway address specified"
);
free
(
gw
);
return
-
1
;
}
...
...
@@ -693,6 +701,7 @@ static int config_network_ipv4_gateway(const char *key, const char *value,
}
else
{
if
(
!
inet_pton
(
AF_INET
,
value
,
gw
))
{
SYSERROR
(
"invalid ipv4 gateway address: %s"
,
value
);
free
(
gw
);
return
-
1
;
}
...
...
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