From 15b8332e7cc09b1ae2ef71265cd63bfbc8075eec Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Thu, 7 Jun 2018 14:37:30 -0700 Subject: [PATCH] networkd: add missing _cleanup_ in prefix_new This should fix a leak of the allocated Prefix if sd_radv_prefix_new fails for some reason. The code was already initializing prefix to NULL and using TAKE_PTR to return it, so only the _cleanup_ was missing. Fixes Coverity finding CID 1382976. --- src/network/networkd-radv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index 464e636876d..14927b04396 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -104,7 +104,7 @@ void prefix_free(Prefix *prefix) { } int prefix_new(Prefix **ret) { - Prefix *prefix = NULL; + _cleanup_(prefix_freep) Prefix *prefix = NULL; prefix = new0(Prefix, 1); if (!prefix) -- 2.47.3