From 2ef7110f37ff1740884d1e22a5213fc87f6c544d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20=C5=A0imerda?= Date: Sat, 27 Jul 2013 00:35:51 +0200 Subject: [PATCH] platform: fix memory leaks --- src/platform/nm-linux-platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index cfd237933a..85ce20adaf 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -1186,13 +1186,14 @@ static struct rtnl_link * link_get (NMPlatform *platform, int ifindex) { NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); - struct rtnl_link *rtnllink = rtnl_link_get (priv->link_cache, ifindex); + auto_nl_object struct rtnl_link *rtnllink = rtnl_link_get (priv->link_cache, ifindex); if (!rtnllink || !g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (ifindex))) { platform->error = NM_PLATFORM_ERROR_NOT_FOUND; return NULL; } + nl_object_get ((struct nl_object *) rtnllink); return rtnllink; } @@ -2363,7 +2364,7 @@ udev_device_removed (NMPlatform *platform, /* Announce device removal if it's still in the Netlink cache. */ if (ifindex) { - struct rtnl_link *device = rtnl_link_get (priv->link_cache, ifindex); + auto_nl_object struct rtnl_link *device = rtnl_link_get (priv->link_cache, ifindex); if (device) announce_object (platform, (struct nl_object *) device, REMOVED);