summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/rtnl-message.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-03-23 15:33:24 +0100
committerTom Gundersen <teg@jklm.no>2014-03-28 00:50:50 +0100
commit8c57830308a612b06b53f5fd31cfb765d8710d68 (patch)
tree963edd7f57665b022a0e2f06cc47167657078dde /src/libsystemd/sd-rtnl/rtnl-message.c
parentbf81e792f3c0aed54edf004c1c95cc6f6d81d0ee (diff)
sd-rtnl: message - don't reference associated rtnl object
The object is not currently used, so just drop the refenence. If/when we end up using the object in the future, we must make sure to deal with possible mutual references between rtnl busses and their queued messages; as is done in sd-bus.
Diffstat (limited to 'src/libsystemd/sd-rtnl/rtnl-message.c')
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 84a8ffa59e..690466e2f0 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -46,6 +46,11 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, size_t initial_size) {
assert_return(ret, -EINVAL);
assert_return(initial_size >= sizeof(struct nlmsghdr), -EINVAL);
+ /* Note that 'rtnl' is curretly unused, if we start using it internally
+ we must take care to avoid problems due to mutual references between
+ busses and their queued messages. See sd-bus.
+ */
+
m = new0(sd_rtnl_message, 1);
if (!m)
return -ENOMEM;
@@ -61,9 +66,6 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, size_t initial_size) {
m->hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
m->sealed = false;
- if (rtnl)
- m->rtnl = sd_rtnl_ref(rtnl);
-
*ret = m;
return 0;
@@ -275,7 +277,6 @@ sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) {
if (m && REFCNT_DEC(m->n_ref) <= 0) {
unsigned i;
- sd_rtnl_unref(m->rtnl);
free(m->hdr);
for (i = 0; i < m->n_containers; i++)