diff options
| author | Roy Marples <roy@marples.name> | 2008-09-04 08:48:06 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-09-04 08:48:06 +0000 |
| commit | b905fc787c1bcc537af52d407bf0bd350a7d5f7a (patch) | |
| tree | 4bbf40ffd97c825e0cb08f7e503228c117b6fbf2 /dhcp.c | |
| parent | f0f4b8b6df73aaa57672c47a7f339b52db23e68f (diff) | |
| download | dhcpcd-b905fc787c1bcc537af52d407bf0bd350a7d5f7a.tar.xz | |
Only free the option buffer when debugging memory leaks.
Diffstat (limited to 'dhcp.c')
| -rw-r--r-- | dhcp.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -245,11 +245,13 @@ valid_length(uint8_t option, int dl, int *type) return 0; } +#ifdef DEBUG_MEMORY static void free_option_buffer(void) { free(dhcp_opt_buffer); } +#endif #define get_option_raw(dhcp, opt) get_option(dhcp, opt, NULL, NULL) static const uint8_t * @@ -270,7 +272,9 @@ get_option(const struct dhcp_message *dhcp, uint8_t opt, int *len, int *type) if (op) { if (!dhcp_opt_buffer) { dhcp_opt_buffer = xmalloc(sizeof(struct dhcp_message)); +#ifdef DEBUG_MEMORY atexit(free_option_buffer); +#endif } if (!bp) bp = dhcp_opt_buffer; |
