summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-03-31 14:43:34 +0200
committerTom Gundersen <teg@jklm.no>2014-03-31 14:43:34 +0200
commit689703f618f99661ca75db7c74984ec0fed27e08 (patch)
treeb3b87e7c017778cbc3de138db2d2c90aef8cb334 /src
parent5fa4ddb88cb0cfb60aff1f502e39788a6ec136d3 (diff)
sd-rtnl: modernize a bit
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 9f3a4f3dea..2ab9d90aa7 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -31,7 +31,7 @@
#include "rtnl-util.h"
static int sd_rtnl_new(sd_rtnl **ret) {
- sd_rtnl *rtnl;
+ _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
assert_return(ret, -EINVAL);
@@ -52,12 +52,12 @@ static int sd_rtnl_new(sd_rtnl **ret) {
/* We guarantee that wqueue always has space for at least
* one entry */
rtnl->wqueue = new(sd_rtnl_message*, 1);
- if (!rtnl->wqueue) {
- free(rtnl);
+ if (!rtnl->wqueue)
return -ENOMEM;
- }
*ret = rtnl;
+ rtnl = NULL;
+
return 0;
}