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
a6537fbb
Commit
a6537fbb
authored
Apr 14, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
genl.c: fix a resource leak found by coverity
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
a741a85d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
genl.c
src/lxc/genl.c
+9
-8
No files found.
src/lxc/genl.c
View file @
a6537fbb
...
@@ -60,45 +60,46 @@ static int genetlink_resolve_family(const char *family)
...
@@ -60,45 +60,46 @@ static int genetlink_resolve_family(const char *family)
ret
=
netlink_open
(
&
handler
,
NETLINK_GENERIC
);
ret
=
netlink_open
(
&
handler
,
NETLINK_GENERIC
);
if
(
ret
)
if
(
ret
)
return
re
t
;
goto
ou
t
;
ret
=
nla_put_string
((
struct
nlmsg
*
)
&
request
->
nlmsghdr
,
ret
=
nla_put_string
((
struct
nlmsg
*
)
&
request
->
nlmsghdr
,
CTRL_ATTR_FAMILY_NAME
,
family
);
CTRL_ATTR_FAMILY_NAME
,
family
);
if
(
ret
)
if
(
ret
)
goto
out
;
goto
out
_close
;
ret
=
netlink_transaction
(
&
handler
,
(
struct
nlmsg
*
)
&
request
->
nlmsghdr
,
ret
=
netlink_transaction
(
&
handler
,
(
struct
nlmsg
*
)
&
request
->
nlmsghdr
,
(
struct
nlmsg
*
)
&
reply
->
nlmsghdr
);
(
struct
nlmsg
*
)
&
reply
->
nlmsghdr
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
out
;
goto
out
_close
;
genlmsghdr
=
NLMSG_DATA
(
&
reply
->
nlmsghdr
);
genlmsghdr
=
NLMSG_DATA
(
&
reply
->
nlmsghdr
);
len
=
reply
->
nlmsghdr
.
nlmsg_len
;
len
=
reply
->
nlmsghdr
.
nlmsg_len
;
ret
=
-
ENOMSG
;
ret
=
-
ENOMSG
;
if
(
reply
->
nlmsghdr
.
nlmsg_type
!=
GENL_ID_CTRL
)
if
(
reply
->
nlmsghdr
.
nlmsg_type
!=
GENL_ID_CTRL
)
goto
out
;
goto
out
_close
;
if
(
genlmsghdr
->
cmd
!=
CTRL_CMD_NEWFAMILY
)
if
(
genlmsghdr
->
cmd
!=
CTRL_CMD_NEWFAMILY
)
goto
out
;
goto
out
_close
;
ret
=
-
EMSGSIZE
;
ret
=
-
EMSGSIZE
;
len
-=
NLMSG_LENGTH
(
GENL_HDRLEN
);
len
-=
NLMSG_LENGTH
(
GENL_HDRLEN
);
if
(
len
<
0
)
if
(
len
<
0
)
goto
out
;
goto
out
_close
;
attr
=
(
struct
nlattr
*
)
GENLMSG_DATA
(
reply
);
attr
=
(
struct
nlattr
*
)
GENLMSG_DATA
(
reply
);
attr
=
(
struct
nlattr
*
)((
char
*
)
attr
+
NLA_ALIGN
(
attr
->
nla_len
));
attr
=
(
struct
nlattr
*
)((
char
*
)
attr
+
NLA_ALIGN
(
attr
->
nla_len
));
ret
=
-
ENOMSG
;
ret
=
-
ENOMSG
;
if
(
attr
->
nla_type
!=
CTRL_ATTR_FAMILY_ID
)
if
(
attr
->
nla_type
!=
CTRL_ATTR_FAMILY_ID
)
goto
out
;
goto
out
_close
;
ret
=
*
(
__u16
*
)
NLA_DATA
(
attr
);
ret
=
*
(
__u16
*
)
NLA_DATA
(
attr
);
out_close:
netlink_close
(
&
handler
);
out:
out:
genlmsg_free
(
request
);
genlmsg_free
(
request
);
genlmsg_free
(
reply
);
genlmsg_free
(
reply
);
netlink_close
(
&
handler
);
return
ret
;
return
ret
;
}
}
...
...
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