From: Patrik Flykt Date: Mon, 27 Nov 2017 12:07:22 +0000 (+0200) Subject: networkd: Free Prefix in case allocation fails (#7480) X-Git-Tag: v236~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a86d329f225cbe093eefe1de37ac5cf2b53b8872;p=thirdparty%2Fsystemd.git networkd: Free Prefix in case allocation fails (#7480) Set the code to call _cleanup_prefix_free_ in case the next allocation fails so that Prefix does not leak memory. Reported by evverx. --- diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 976be17c0e4..ff125e35dee 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -1035,7 +1035,7 @@ void prefix_free(Prefix *prefix) { } int prefix_new(Prefix **ret) { - Prefix *prefix = NULL; + _cleanup_prefix_free_ Prefix *prefix = NULL; prefix = new0(Prefix, 1); if (!prefix)