From: Susant Sahani Date: Thu, 31 Oct 2019 13:25:16 +0000 (+0100) Subject: Fix CID 1406578: Resource leaks (RESOURCE_LEAK) X-Git-Tag: v244-rc1~117 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0619079cc9f3c81da24b38f803e7aadb85be953;p=thirdparty%2Fsystemd.git Fix CID 1406578: Resource leaks (RESOURCE_LEAK) ** CID 1406578: Resource leaks (RESOURCE_LEAK) /src/libsystemd-network/sd-dhcp-server.c: 155 in sd_dhcp_raw_option_new() --- diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index f7022dd7154..0f000f50553 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -136,7 +136,7 @@ static sd_dhcp_raw_option* raw_option_free(sd_dhcp_raw_option *i) { } _public_ int sd_dhcp_raw_option_new(uint8_t type, char *data, size_t length, sd_dhcp_raw_option **ret) { - sd_dhcp_raw_option *p; + _cleanup_(sd_dhcp_raw_option_unrefp) sd_dhcp_raw_option *p = NULL; assert_return(ret, -EINVAL); @@ -156,7 +156,7 @@ _public_ int sd_dhcp_raw_option_new(uint8_t type, char *data, size_t length, sd_ return -ENOMEM; } - *ret = p; + *ret = TAKE_PTR(p); return 0; }