#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.26.2.4 1999/03/26 16:49:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.26.2.5 1999/03/29 22:17:53 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
/* If we haven't seen this option before, just make
space for it and copy it there. */
if (!packet -> options [code].data) {
- if (!(t = (unsigned char *)malloc (len + 1)))
+ if (!(t = ((unsigned char *)
+ dmalloc (len + 1, "parse_option_buffer"))))
error ("Can't allocate storage for option %s.",
dhcp_options [code].name);
/* Copy and NUL-terminate the option (in case it's an
/* If it's a repeat, concatenate it to whatever
we last saw. This is really only required
for clients, but what the heck... */
- t = (unsigned char *)
- malloc (len
- + packet -> options [code].len
- + 1);
+ t = ((unsigned char *)
+ dmalloc (len + packet -> options [code].len + 1,
+ "parse_option_buffer");
if (!t)
error ("Can't expand storage for option %s.",
dhcp_options [code].name);
&s [2], len);
packet -> options [code].len += len;
t [packet -> options [code].len] = 0;
- free (packet -> options [code].data);
+ dfree (packet -> options [code].data,
+ "parse_option_buffer");
packet -> options [code].data = t;
}
s += len + 2;
dhcp (&tp);
else
bootp (&tp);
+
+ /* Free the data associated with the options. */
+ for (i = 0; i < 256; i++) {
+ if (packet -> options [i].len &&
+ packet -> options [i].data)
+ dfree (packet -> options [i].data, "do_packet");
+ }
}