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 8f54906..2a46624 100644 (file)
@@ -413,7 +413,7 @@ static int client_send_discover(sd_dhcp_client *client) {
 }
 
 static int client_send_request(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;
 
         size_t optoffset, optlen;
         int r;