chiark / gitweb /
sd-dhcp-client: check return from dhcp_option_append
[elogind.git] / src / libsystemd-network / sd-dhcp-client.c
index 8f549060bf9750c8902544bddd8aa630663978ea..c1af6df13191352488b6715c95553846c2d17493 100644 (file)
@@ -398,6 +398,8 @@ static int client_send_discover(sd_dhcp_client *client) {
 
         r = dhcp_option_append(&discover->dhcp, optlen, &optoffset, 0,
                                DHCP_OPTION_END, 0, NULL);
+        if (r < 0)
+                return r;
 
         /* We currently ignore:
            The client SHOULD wait a random time between one and ten seconds to
@@ -413,7 +415,7 @@ static int client_send_discover(sd_dhcp_client *client) {
 }
 
 static int client_send_request(sd_dhcp_client *client) {
-        _cleanup_free_ DHCPPacket *request;
+        _cleanup_free_ DHCPPacket *request = NULL;
         size_t optoffset, optlen;
         int r;