43 log_error (
"%s(%d): null pointer", file, line);
44 #if defined (POINTER_DEBUG) 51 log_error (
"%s(%d): non-null pointer", file, line);
52 #if defined (POINTER_DEBUG) 59 h =
dmalloc (
sizeof *h, file, line);
61 memset (h, 0,
sizeof *h);
74 log_error (
"%s(%d): null pointer", file, line);
75 #if defined (POINTER_DEBUG) 82 log_error (
"%s(%d): non-null pointer", file, line);
83 #if defined (POINTER_DEBUG) 104 log_error (
"%s(%d): null pointer", file, line);
105 #if defined (POINTER_DEBUG) 112 option_chain_head = *ptr;
113 *ptr = (
struct option_chain_head *)0;
114 --option_chain_head ->
refcnt;
117 if (option_chain_head ->
refcnt > 0)
120 if (option_chain_head ->
refcnt < 0) {
121 log_error (
"%s(%d): negative refcnt!", file, line);
122 #if defined (DEBUG_RC_HISTORY) 123 dump_rc_history (option_chain_head);
125 #if defined (POINTER_DEBUG) 133 for (car = option_chain_head ->
first; car; car = cdr) {
141 dfree (option_chain_head, file, line);
153 log_error (
"%s(%d): null pointer", file, line);
154 #if defined (POINTER_DEBUG) 161 log_error (
"%s(%d): non-null pointer", file, line);
162 #if defined (POINTER_DEBUG) 165 *ptr = (
struct group *)0;
169 g =
dmalloc (
sizeof *g, file, line);
171 memset (g, 0,
sizeof *g);
184 log_error (
"%s(%d): null pointer", file, line);
185 #if defined (POINTER_DEBUG) 192 log_error (
"%s(%d): non-null pointer", file, line);
193 #if defined (POINTER_DEBUG) 196 *ptr = (
struct group *)0;
213 log_error (
"%s(%d): null pointer", file, line);
214 #if defined (POINTER_DEBUG) 222 *ptr = (
struct group *)0;
228 if (group ->
refcnt < 0) {
229 log_error (
"%s(%d): negative refcnt!", file, line);
230 #if defined (DEBUG_RC_HISTORY) 231 dump_rc_history (group);
233 #if defined (POINTER_DEBUG) 241 group_object_dereference (&group ->
object, file, line);
243 subnet_dereference (&group ->
subnet, file, line);
252 dfree (group, file, line);
297 dfree ((
void *)ptr, file, line);
313 memcpy(rval + 1, name, len);
314 rval->
name = (
char *)(rval + 1);
334 dfree ((
void *)ptr, file, line);
342 dfree ((
void *)ptr, file, line);
350 dfree ((
void *)ptr, file, line);
358 dfree ((
void *)ptr, file, line);
374 dfree (lease, file, line);
387 free_pairs = foo -> cdr;
388 memset (foo, 0,
sizeof *foo);
393 foo =
dmalloc (
sizeof *foo, file, line);
396 memset (foo, 0,
sizeof *foo);
410 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 411 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 412 void relinquish_free_pairs ()
416 for (pf = free_pairs; pf; pf = pc) {
420 free_pairs = (
pair)0;
433 if (free_expressions) {
435 free_expressions = rval ->
data.
not;
442 memset (rval, 0,
sizeof *rval);
453 log_error (
"%s(%d): null pointer", file, line);
454 #if defined (POINTER_DEBUG) 461 log_error (
"%s(%d): non-null pointer", file, line);
462 #if defined (POINTER_DEBUG) 480 free_expressions = expr;
484 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 485 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 486 void relinquish_free_expressions ()
490 for (e = free_expressions; e; e = n) {
507 if (free_binding_values) {
509 free_binding_values = rval ->
value.
bv;
516 memset (rval, 0,
sizeof *rval);
527 log_error (
"%s(%d): null pointer", file, line);
528 #if defined (POINTER_DEBUG) 535 log_error (
"%s(%d): non-null pointer", file, line);
536 #if defined (POINTER_DEBUG) 554 free_binding_values = bv;
558 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 559 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 560 void relinquish_free_binding_values ()
564 for (b = free_binding_values; b; b = n) {
582 memset (rval, 0,
sizeof *rval);
593 log_error (
"%s(%d): null pointer", file, line);
594 #if defined (POINTER_DEBUG) 601 log_error (
"%s(%d): non-null pointer", file, line);
602 #if defined (POINTER_DEBUG) 605 *ptr = (
struct fundef *)0;
616 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 617 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 618 void relinquish_free_option_caches ()
622 for (o = free_option_caches; o; o = n) {
637 if (free_option_caches) {
647 memset (rval, 0,
sizeof *rval);
658 log_error (
"%s(%d): null pointer", file, line);
659 #if defined (POINTER_DEBUG) 666 log_error (
"%s(%d): non-null pointer", file, line);
667 #if defined (POINTER_DEBUG) 689 bp =
dmalloc (len +
sizeof *bp, file, line);
693 memset (bp, 0,
sizeof *bp);
705 log_error (
"%s(%d): null pointer", file, line);
706 #if defined (POINTER_DEBUG) 713 log_error (
"%s(%d): non-null pointer", file, line);
714 #if defined (POINTER_DEBUG) 717 *ptr = (
struct buffer *)0;
732 log_error (
"%s(%d): null pointer", file, line);
733 #if defined (POINTER_DEBUG) 741 log_error (
"%s(%d): null pointer", file, line);
742 #if defined (POINTER_DEBUG) 752 dfree ((*ptr), file, line);
753 }
else if ((*ptr) ->
refcnt < 0) {
754 log_error (
"%s(%d): negative refcnt!", file, line);
755 #if defined (DEBUG_RC_HISTORY) 756 dump_rc_history (*ptr);
758 #if defined (POINTER_DEBUG) 764 *ptr = (
struct buffer *)0;
770 const
char *hostname;
776 bp =
dmalloc (strlen (hostname) +
sizeof *bp, file, line);
779 memset (bp, 0,
sizeof *bp);
781 strcpy (bp -> hostname, hostname);
792 log_error (
"%s(%d): null pointer", file, line);
793 #if defined (POINTER_DEBUG) 800 log_error (
"%s(%d): non-null pointer", file, line);
801 #if defined (POINTER_DEBUG) 819 log_error (
"%s(%d): null pointer", file, line);
820 #if defined (POINTER_DEBUG) 829 if ((*ptr)->refcnt == 0) {
830 dfree ((*ptr), file, line);
831 }
else if ((*ptr)->refcnt < 0) {
832 log_error (
"%s(%d): negative refcnt!", file, line);
833 #if defined (DEBUG_RC_HISTORY) 834 dump_rc_history (*ptr);
836 #if defined (POINTER_DEBUG) 854 log_error (
"%s(%d): null pointer", file, line);
855 #if defined (POINTER_DEBUG) 862 log_error (
"%s(%d): non-null pointer", file, line);
863 #if defined (POINTER_DEBUG) 871 *ptr =
dmalloc (size, file, line);
873 memset (*ptr, 0, size);
890 log_error (
"%s(%d): null pointer", file, line);
891 #if defined (POINTER_DEBUG) 898 log_error (
"%s(%d): non-null pointer", file, line);
899 #if defined (POINTER_DEBUG) 920 log_error (
"%s(%d): null pointer", file, line);
921 #if defined (POINTER_DEBUG) 932 if (options ->
refcnt > 0)
935 if (options ->
refcnt < 0) {
936 log_error (
"%s(%d): negative refcnt!", file, line);
937 #if defined (DEBUG_RC_HISTORY) 938 dump_rc_history (options);
940 #if defined (POINTER_DEBUG) 954 dfree (options, file, line);
965 bp =
dmalloc (
sizeof *bp, file, line);
968 memset (bp, 0,
sizeof *bp);
979 log_error (
"%s(%d): null pointer", file, line);
980 #if defined (POINTER_DEBUG) 987 log_error (
"%s(%d): non-null pointer", file, line);
988 #if defined (POINTER_DEBUG) 1000 static struct packet *free_packets;
1002 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 1003 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 1004 void relinquish_free_packets ()
1007 for (p = free_packets; p; p = n) {
1011 free_packets = (
struct packet *)0;
1023 log_error (
"%s(%d): null pointer", file, line);
1024 #if defined (POINTER_DEBUG) 1031 log_error (
"%s(%d): non-null pointer", file, line);
1032 #if defined (POINTER_DEBUG) 1035 *ptr = (
struct packet *)0;
1041 free_packets = (
struct packet *)(p ->
raw);
1044 p =
dmalloc (
sizeof *p, file, line);
1047 memset (p, 0,
sizeof *p);
1060 log_error (
"%s(%d): null pointer", file, line);
1061 #if defined (POINTER_DEBUG) 1068 log_error (
"%s(%d): non-null pointer", file, line);
1069 #if defined (POINTER_DEBUG) 1072 *ptr = (
struct packet *)0;
1089 if (!ptr || !*ptr) {
1090 log_error (
"%s(%d): null pointer", file, line);
1091 #if defined (POINTER_DEBUG) 1099 *ptr = (
struct packet *)0;
1102 if (packet ->
refcnt > 0)
1105 if (packet ->
refcnt < 0) {
1106 log_error (
"%s(%d): negative refcnt!", file, line);
1107 #if defined (DEBUG_RC_HISTORY) 1108 dump_rc_history (packet);
1110 #if defined (POINTER_DEBUG) 1129 free_packets = packet;
1142 log_error (
"%s(%d): null pointer", file, line);
1143 #if defined (POINTER_DEBUG) 1150 log_error (
"%s(%d): non-null pointer", file, line);
1151 #if defined (POINTER_DEBUG) 1158 d =
dmalloc (
sizeof *d, file, line);
1160 memset (d, 0,
sizeof *d);
1173 log_error (
"%s(%d): null pointer", file, line);
1174 #if defined (POINTER_DEBUG) 1181 log_error (
"%s(%d): non-null pointer", file, line);
1182 #if defined (POINTER_DEBUG) 1202 log_error (
"%s(%d): null pointer", file, line);
1203 #if defined (POINTER_DEBUG) 1211 log_error (
"%s(%d): non-null pointer", file, line);
1212 #if defined (POINTER_DEBUG) 1219 bp =
dmalloc (
sizeof *bp, file, line);
1222 memset (bp, 0,
sizeof *bp);
1234 log_error (
"%s(%d): null pointer", file, line);
1235 #if defined (POINTER_DEBUG) 1242 log_error (
"%s(%d): non-null pointer", file, line);
1243 #if defined (POINTER_DEBUG) 1273 const char *src,
unsigned int len,
1276 unsigned int copy_len = 0;
1278 if (new_string == NULL) {
1279 log_error(
"data_string_new: new_string cannot be NULL %s(%d)",
1285 log_error(
"data_string_new: src cannot be NULL %s(%d)",
1290 memset(new_string, 0,
sizeof (
struct data_string));
1294 copy_len = (len > 0 && src[len - 1] == 0) ? len - 1 : len;
1298 log_error(
"data_string_new: No memory %s(%d)", file, line);
1304 memcpy(new_string->
buffer->
data, src, copy_len);
1313 new_string->
len = copy_len;
1331 dest -> data = src -> data;
1332 dest -> terminated = src -> terminated;
1333 dest -> len = src -> len;
1346 memset (data, 0,
sizeof *data);
1357 if (len < dp -> len) {
1358 dp -> terminated = 0;
1389 if (str->terminated == 0) {
1391 memset(&temp, 0,
sizeof(temp));
#define rc_register(file, line, reference, addr, refcnt, d, f)
int data_string_new(struct data_string *new_string, const char *src, unsigned int len, const char *file, int line)
Constructs a null-terminated data_string from a char* and length.
int executable_statement_reference(struct executable_statement **ptr, struct executable_statement *bp, const char *file, int line)
int executable_statement_allocate(struct executable_statement **ptr, const char *file, int line)
int fundef_reference(struct fundef **ptr, struct fundef *src, const char *file, int line)
struct option_cache * free_option_caches
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
struct universe * new_universe(char *file, int line) const
isc_result_t omapi_object_dereference(omapi_object_t **h, const char *file, int line)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
void free_domain_search_list(struct domain_search_list *ptr, const char *file, int line)
int expression_allocate(struct expression **cptr, const char *file, int line)
int binding_value_reference(struct binding_value **ptr, struct binding_value *src, const char *file, int line)
pair new_pair(char *file, int line) const
int group_reference(struct group **ptr, struct group *bp, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
void free_universe(struct universe *ptr, const char *file, int line)
int option_cache_reference(struct option_cache **ptr, struct option_cache *src, const char *file, int line)
int fundef_allocate(struct fundef **cptr, const char *file, int line)
int log_error(const char *,...) __attribute__((__format__(__printf__
int dns_zone_reference(struct dns_zone **ptr, struct dns_zone *bp, const char *file, int line)
struct domain_search_list * new_domain_search_list(char *file, int line) const
struct name_server * new_name_server(char *file, int line) const
struct option_state * options
void data_string_truncate(struct data_string *dp, int len)
void free_name_server(struct name_server *ptr, const char *file, int line)
int buffer_reference(struct buffer **ptr, struct buffer *bp, const char *file, int line)
int binding_value_allocate(struct binding_value **cptr, const char *file, int line)
struct executable_statement * statements
int option_cache_allocate(struct option_cache **cptr, const char *file, int line)
int option_state_reference(struct option_state **ptr, struct option_state *bp, const char *file, int line)
union expression::expr_union data
int option_state_allocate(struct option_state **ptr, const char *file, int line)
int option_chain_head_dereference(struct option_chain_head **ptr, const char *file, int line)
int packet_reference(struct packet **ptr, struct packet *bp, const char *file, int line)
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
struct class * classes[PACKET_MAX_CLASSES]
struct interface_info * interface
int binding_scope_allocate(struct binding_scope **ptr, const char *file, int line)
int group_dereference(struct group **ptr, const char *file, int line)
int group_allocate(struct group **ptr, const char *file, int line)
void dfree(void *ptr, const char *file, int line)
struct binding_value * free_binding_values
void * dmalloc(size_t size, const char *file, int line)
struct expression * free_expressions
struct option * new_option(char *name, const char *file, int line) const
int option_chain_head_reference(struct option_chain_head **ptr, struct option_chain_head *bp, const char *file, int line)
struct dhcp_packet * dhcp_free_list
void free_client_lease(struct client_lease *lease, const char *file, int line)
struct packet * packet_free_list
union binding_value::value value
struct universe ** universes
int option_state_dereference(struct option_state **ptr, const char *file, int line)
int binding_scope_reference(struct binding_scope **ptr, struct binding_scope *bp, const char *file, int line)
void free_protocol(struct protocol *ptr, const char *file, int line)
void free_pair(pair foo, const char *file, int line)
int packet_dereference(struct packet **ptr, const char *file, int line)
int packet_allocate(struct packet **ptr, const char *file, int line)
int option_chain_head_allocate(struct option_chain_head **ptr, const char *file, int line)
void free_expression(struct expression *expr, const char *file, int line)
struct client_lease * new_client_lease(char *file, int line) const
#define dmalloc_reuse(x, y, l, z)
struct protocol * new_protocol(char *file, int line) const
int expression_reference(struct expression **ptr, struct expression *src, const char *file, int line)
int dns_host_entry_allocate(struct dns_host_entry **ptr, const char *hostname, const char *file, int line)
int dns_host_entry_dereference(struct dns_host_entry **ptr, const char *file, int line)
struct binding_value * bv
int dns_zone_allocate(struct dns_zone **ptr, const char *file, int line)
const unsigned char * data
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
void free_binding_value(struct binding_value *bv, const char *file, int line)
int dns_host_entry_reference(struct dns_host_entry **ptr, struct dns_host_entry *bp, const char *file, int line)
struct dhcp_packet * new_dhcp_packet(char *file, int line) const
#define PACKET_MAX_CLASSES
void free_dhcp_packet(struct dhcp_packet *ptr, const char *file, int line)
int buffer_dereference(struct buffer **ptr, const char *file, int line)
int data_string_terminate(struct data_string *str, const char *file, int line)