]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: add missing _cleanup_ in prefix_new
authorFilipe Brandenburger <filbranden@google.com>
Thu, 7 Jun 2018 21:37:30 +0000 (14:37 -0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Jun 2018 22:48:41 +0000 (00:48 +0200)
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

index 464e636876d2b25bdeb51bf1b57b7bdbac5dfa21..14927b04396591ffd8191c98ac31580115ff1505 100644 (file)
@@ -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)