chiark / gitweb /
sd-dhcp-client: fix invalid free() in client_send_request()
authorAndreas Henriksson <andreas@fatal.se>
Fri, 13 Jun 2014 16:48:20 +0000 (18:48 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 13 Jun 2014 16:57:33 +0000 (18:57 +0200)
static int client_send_request(...) in
./src/libsystemd-network/sd-dhcp-client.c tries to initialize
"request" by calling client_message_init(...), which has atleast
5 error cases where it can return without that happening.
This leads to the function finishing without "request" being initialized.

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

index 8f549060bf9750c8902544bddd8aa630663978ea..2a46624f2e8c328e41c520e3377c96dd15f1c92d 100644 (file)
@@ -413,7 +413,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;