2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 13:57:50 +00:00

Add a scary debugging mode for finding host allocation errors.

This commit is contained in:
Ted Lemon
2001-04-27 21:30:15 +00:00
parent b7f800382a
commit ae9c72b723

View File

@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: salloc.c,v 1.1 2000/05/16 23:11:42 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: salloc.c,v 1.2 2001/04/27 21:30:15 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -61,7 +61,36 @@ struct lease *new_leases (n, file, line)
OMAPI_OBJECT_ALLOC (lease, struct lease, dhcp_type_lease)
OMAPI_OBJECT_ALLOC (class, struct class, dhcp_type_class)
OMAPI_OBJECT_ALLOC (pool, struct pool, dhcp_type_pool)
#if !defined (NO_HOST_FREES) /* Scary debugging mode - don't enable! */
OMAPI_OBJECT_ALLOC (host, struct host_decl, dhcp_type_host)
#else
isc_result_t host_allocate (struct host_decl **p, const char *file, int line)
{
return omapi_object_allocate ((omapi_object_t **)p,
dhcp_type_host, 0, file, line);
}
isc_result_t host_reference (struct host_decl **pptr, struct host_decl *ptr,
const char *file, int line)
{
return omapi_object_reference ((omapi_object_t **)pptr,
(omapi_object_t *)ptr, file, line);
}
isc_result_t host_dereference (struct host_decl **ptr,
const char *file, int line)
{
if ((*ptr) -> refcnt == 1) {
log_error ("host dereferenced with refcnt == 1.");
#if defined (DEBUG_RC_HISTORY)
dump_rc_history ();
#endif
abort ();
}
return omapi_object_dereference ((omapi_object_t **)ptr, file, line);
}
#endif
struct lease_state *free_lease_states;