diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-04-05 07:26:26 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-04-05 07:26:26 +0200 |
commit | 1cc6c93a9569a9f2664d0d26cd0e50408307c430 (patch) | |
tree | 57e115a1beb9b097f731da79c3192015ff35cc94 /src/libsystemd/sd-netlink/netlink-socket.c | |
parent | network: fix typo in log message (diff) | |
download | systemd-1cc6c93a9569a9f2664d0d26cd0e50408307c430.tar.xz systemd-1cc6c93a9569a9f2664d0d26cd0e50408307c430.zip |
tree-wide: use TAKE_PTR() and TAKE_FD() macros
Diffstat (limited to 'src/libsystemd/sd-netlink/netlink-socket.c')
-rw-r--r-- | src/libsystemd/sd-netlink/netlink-socket.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c index 3474ad9ddb..7db9205d7d 100644 --- a/src/libsystemd/sd-netlink/netlink-socket.c +++ b/src/libsystemd/sd-netlink/netlink-socket.c @@ -433,8 +433,7 @@ int socket_read_message(sd_netlink *rtnl) { /* push the message onto the multi-part message stack */ if (first) m->next = first; - first = m; - m = NULL; + first = TAKE_PTR(m); } if (len > 0) @@ -449,8 +448,7 @@ int socket_read_message(sd_netlink *rtnl) { if (r < 0) return r; - rtnl->rqueue[rtnl->rqueue_size++] = first; - first = NULL; + rtnl->rqueue[rtnl->rqueue_size++] = TAKE_PTR(first); if (multi_part && (i < rtnl->rqueue_partial_size)) { /* remove the message form the partial read queue */ @@ -464,15 +462,14 @@ int socket_read_message(sd_netlink *rtnl) { /* we only got a partial multi-part message, push it on the partial read queue */ if (i < rtnl->rqueue_partial_size) - rtnl->rqueue_partial[i] = first; + rtnl->rqueue_partial[i] = TAKE_PTR(first); else { r = rtnl_rqueue_partial_make_room(rtnl); if (r < 0) return r; - rtnl->rqueue_partial[rtnl->rqueue_partial_size++] = first; + rtnl->rqueue_partial[rtnl->rqueue_partial_size++] = TAKE_PTR(first); } - first = NULL; return 0; } |