]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Fix CID 1406578: Resource leaks (RESOURCE_LEAK)
authorSusant Sahani <ssahani@vmware.com>
Thu, 31 Oct 2019 13:25:16 +0000 (14:25 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 31 Oct 2019 20:13:57 +0000 (21:13 +0100)
** CID 1406578:  Resource leaks  (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 155 in sd_dhcp_raw_option_new()

src/libsystemd-network/sd-dhcp-server.c

index f7022dd715450580289e96c4509d0f4fe68fe86a..0f000f505531003b27e814f56c987b17a0446c9e 100644 (file)
@@ -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;
 }