mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 22:35:25 +00:00
Fix memory leak, bug in nwip option handling.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: options.c,v 1.83 2001/01/26 06:17:01 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: options.c,v 1.84 2001/02/12 19:43:32 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define DHCP_OPTION_DATA
|
#define DHCP_OPTION_DATA
|
||||||
@@ -829,6 +829,7 @@ int store_options (buffer, buflen, packet, lease, client_state,
|
|||||||
cfg_options, scope, oc, MDL);
|
cfg_options, scope, oc, MDL);
|
||||||
if (!od.len) {
|
if (!od.len) {
|
||||||
data_string_forget (&encapsulation, MDL);
|
data_string_forget (&encapsulation, MDL);
|
||||||
|
data_string_forget (&od, MDL);
|
||||||
have_encapsulation = 0;
|
have_encapsulation = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1677,25 +1678,28 @@ int nwip_option_space_encapsulate (result, packet, lease, client_state,
|
|||||||
struct binding_scope **scope;
|
struct binding_scope **scope;
|
||||||
struct universe *universe;
|
struct universe *universe;
|
||||||
{
|
{
|
||||||
pair p, *hash;
|
pair ocp;
|
||||||
int status;
|
int status;
|
||||||
int i;
|
int i;
|
||||||
static struct option_cache *no_nwip;
|
static struct option_cache *no_nwip;
|
||||||
struct data_string ds;
|
struct data_string ds;
|
||||||
|
struct option_chain_head *head;
|
||||||
|
|
||||||
if (universe -> index >= cfg_options -> universe_count)
|
if (universe -> index >= cfg_options -> universe_count)
|
||||||
return 0;
|
return 0;
|
||||||
|
head = ((struct option_chain_head *)
|
||||||
|
cfg_options -> universes [fqdn_universe.index]);
|
||||||
|
if (!head)
|
||||||
|
return 0;
|
||||||
|
|
||||||
hash = cfg_options -> universes [universe -> index];
|
|
||||||
status = 0;
|
status = 0;
|
||||||
for (i = 0; hash && i < OPTION_HASH_SIZE; i++) {
|
for (ocp = head -> first; ocp; ocp = ocp -> cdr) {
|
||||||
for (p = hash [i]; p; p = p -> cdr) {
|
struct option_cache *oc = (struct option_cache *)(ocp -> car);
|
||||||
if (store_option (result, universe, packet,
|
if (store_option (result, universe, packet,
|
||||||
lease, client_state, in_options,
|
lease, client_state, in_options,
|
||||||
cfg_options, scope,
|
cfg_options, scope,
|
||||||
(struct option_cache *)p -> car))
|
(struct option_cache *)ocp -> car))
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's no data, the nwip suboption is supposed to contain
|
/* If there's no data, the nwip suboption is supposed to contain
|
||||||
@@ -2103,6 +2107,10 @@ void do_packet (interface, packet, len, from_port, from, hfrom)
|
|||||||
unsigned long previous_outstanding = dmalloc_outstanding;
|
unsigned long previous_outstanding = dmalloc_outstanding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (TRACING)
|
||||||
|
trace_inpacket_stash (interface, packet, len, from_port, from, hfrom);
|
||||||
|
#endif
|
||||||
|
|
||||||
decoded_packet = (struct packet *)0;
|
decoded_packet = (struct packet *)0;
|
||||||
if (!packet_allocate (&decoded_packet, MDL)) {
|
if (!packet_allocate (&decoded_packet, MDL)) {
|
||||||
log_error ("do_packet: no memory for incoming packet!");
|
log_error ("do_packet: no memory for incoming packet!");
|
||||||
|
Reference in New Issue
Block a user