summaryrefslogtreecommitdiffstats
path: root/libnl_2
diff options
context:
space:
mode:
authorFrank Maker <ffrank@google.com>2011-08-01 19:51:49 -0700
committerFrank Maker <ffrank@google.com>2011-08-02 15:30:44 -0700
commit69bc179b203c17380ba0b4fda7cf99af65cc5324 (patch)
treeb9e4be2d9cbf5afcb508d805e5757b42e4da2fc4 /libnl_2
parenta43546a874890064606489f2125181a5f65adacd (diff)
downloadsystem_core-69bc179b203c17380ba0b4fda7cf99af65cc5324.zip
system_core-69bc179b203c17380ba0b4fda7cf99af65cc5324.tar.gz
system_core-69bc179b203c17380ba0b4fda7cf99af65cc5324.tar.bz2
libnl: BUGFIX to support wpa_supplicant p2p_find
Close socket file descriptor when nl_msg freed Correct nested attribute container size when closing nest
Diffstat (limited to 'libnl_2')
-rw-r--r--libnl_2/attr.c9
-rw-r--r--libnl_2/socket.c1
2 files changed, 10 insertions, 0 deletions
diff --git a/libnl_2/attr.c b/libnl_2/attr.c
index 9467668..d416350 100644
--- a/libnl_2/attr.c
+++ b/libnl_2/attr.c
@@ -87,8 +87,17 @@ struct nlattr *nla_nest_start(struct nl_msg *msg, int attrtype)
/* Finalize nesting of attributes. */
int nla_nest_end(struct nl_msg *msg, struct nlattr *start)
{
+ struct nlattr *container;
+
+ /* Adjust nested attribute container size */
+ container = (unsigned char *) start - sizeof(struct nlattr);
+ container->nla_len = (unsigned char *) \
+ nlmsg_tail(nlmsg_hdr(msg)) - (unsigned char *)container;
+
+ /* Fix attribute size */
start->nla_len = (unsigned char *) \
nlmsg_tail(nlmsg_hdr(msg)) - (unsigned char *)start;
+
return 0;
}
diff --git a/libnl_2/socket.c b/libnl_2/socket.c
index 3bcf210..ce54f19 100644
--- a/libnl_2/socket.c
+++ b/libnl_2/socket.c
@@ -91,6 +91,7 @@ struct nl_sock *nl_socket_alloc_cb(struct nl_cb *cb)
void nl_socket_free(struct nl_sock *sk)
{
nl_cb_put(sk->s_cb);
+ close(sk->s_fd);
free(sk);
}