aboutsummaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-01-15 18:36:36 +0100
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-01-18 11:58:20 +1100
commit2e9f1f28d236ba2376d4af22fd4181d309082820 (patch)
tree05193c87bac138cf790ed4b948c67cf9d524cb22 /clients
parentc0fbf94bc5d667957df0eeffbfc001829179b332 (diff)
downloadSLOF-2e9f1f28d236ba2376d4af22fd4181d309082820.zip
SLOF-2e9f1f28d236ba2376d4af22fd4181d309082820.tar.gz
SLOF-2e9f1f28d236ba2376d4af22fd4181d309082820.tar.bz2
net-snk: Fix memory leak in dhcp6_process_options()
The dhcp6_process_options() function allocates a struct dhcp6_received_options each time it is called - but that struct never gets used - and especially is also never freed again. Fix this memory leak by simply removing the unused code. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'clients')
-rw-r--r--clients/net-snk/app/netlib/dhcpv6.c12
-rw-r--r--clients/net-snk/app/netlib/dhcpv6.h6
2 files changed, 2 insertions, 16 deletions
diff --git a/clients/net-snk/app/netlib/dhcpv6.c b/clients/net-snk/app/netlib/dhcpv6.c
index b9022ed..d0a22d5 100644
--- a/clients/net-snk/app/netlib/dhcpv6.c
+++ b/clients/net-snk/app/netlib/dhcpv6.c
@@ -130,8 +130,7 @@ dhcpv6 ( char *ret_buffer, void *fn_ip)
return 0;
}
-static struct dhcp6_received_options *
-dhcp6_process_options (uint8_t *option, int32_t option_length)
+static void dhcp6_process_options (uint8_t *option, int32_t option_length)
{
struct dhcp_boot_url *option_boot_url;
struct client_identifier *option_clientid;
@@ -139,24 +138,19 @@ dhcp6_process_options (uint8_t *option, int32_t option_length)
struct dhcp_dns *option_dns;
struct dhcp_dns_list *option_dns_list;
struct dhcp6_gen_option *option_gen;
- struct dhcp6_received_options *received_options;
char buffer[256];
-
- received_options = malloc (sizeof(struct dhcp6_received_options));
while (option_length > 0) {
switch ((uint16_t) *(option+1)) {
case DHCPV6_OPTION_CLIENTID:
option_clientid = (struct client_identifier *) option;
option = option + option_clientid->length + 4;
option_length = option_length - option_clientid->length - 4;
- received_options->client_id = 1;
break;
case DHCPV6_OPTION_SERVERID:
option_serverid = (struct server_identifier *) option;
option = option + option_serverid->length + 4;
option_length = option_length - option_serverid->length - 4;
- received_options->server_id = 1;
break;
case DHCPV6_OPTION_DNS_SERVERS:
option_dns = (struct dhcp_dns *) option;
@@ -185,7 +179,7 @@ dhcp6_process_options (uint8_t *option, int32_t option_length)
(char *)my_fn_ip->filename,
(int)my_fn_ip->fd,
option_boot_url->length) == -1)
- return NULL;
+ return;
break;
default:
option_gen = (struct dhcp6_gen_option *) option;
@@ -193,8 +187,6 @@ dhcp6_process_options (uint8_t *option, int32_t option_length)
option_length = option_length - option_gen->length - 4;
}
}
-
- return received_options;
}
uint32_t
diff --git a/clients/net-snk/app/netlib/dhcpv6.h b/clients/net-snk/app/netlib/dhcpv6.h
index 404706e..fb77da6 100644
--- a/clients/net-snk/app/netlib/dhcpv6.h
+++ b/clients/net-snk/app/netlib/dhcpv6.h
@@ -144,12 +144,6 @@ struct dhcp_boot_url {
uint8_t url[256];
};
-struct dhcp6_received_options {
- uint8_t filename;
- uint8_t ip;
- uint8_t client_id;
- uint8_t server_id;
-};
struct dhcp_message_reply {
uint8_t type; /* Message type */
uint8_t transaction_id[3]; /* Transaction id */