diff options
author | Wlodek Wencel <wlodek@isc.org> | 2022-01-25 18:57:28 +0100 |
---|---|---|
committer | Wlodek Wencel <wlodek@isc.org> | 2022-01-25 18:57:28 +0100 |
commit | e9d37e26897a349f8483092fd0305ea03a97b0e2 (patch) | |
tree | 5ccf3e3afaee5c9cbce00d23db33c4af019de32b /omapip/alloc.c | |
parent | 8eec892acc041bbdb361d1c1ac36a26b3d3cc2db (diff) | |
parent | 3d53b2f2a0369c2af83c738d4e8194077315cbb4 (diff) | |
download | isc-dhcp-e9d37e26897a349f8483092fd0305ea03a97b0e2.tar.gz |
Diffstat (limited to 'omapip/alloc.c')
-rw-r--r-- | omapip/alloc.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/omapip/alloc.c b/omapip/alloc.c index 90bd9040..d13d3d7e 100644 --- a/omapip/alloc.c +++ b/omapip/alloc.c @@ -4,7 +4,7 @@ protocol... */ /* - * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * This Source Code Form is subject to the terms of the Mozilla Public @@ -20,8 +20,8 @@ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Internet Systems Consortium, Inc. - * 950 Charter Street - * Redwood City, CA 94063 + * PO Box 360 + * Newmarket, NH 03857 USA * <info@isc.org> * https://www.isc.org/ * @@ -141,7 +141,7 @@ dmalloc(size_t size, const char *file, int line) { return bar; } -void +void dfree(void *ptr, const char *file, int line) { if (!ptr) { log_error ("dfree %s(%d): free on null pointer.", file, line); @@ -208,7 +208,7 @@ dfree(void *ptr, const char *file, int line) { /* For allocation functions that keep their own free lists, we want to account for the reuse of the memory. */ -void +void dmalloc_reuse(void *foo, const char *file, int line, int justref) { struct dmalloc_preamble *dp; @@ -333,7 +333,7 @@ void dmalloc_dump_outstanding () if (!inhistory) #endif log_info (" %s(%d): %ld", - dp -> file, dp -> line, + dp -> file, dp -> line, (long) dp -> size); } #endif @@ -535,11 +535,11 @@ isc_result_t omapi_object_allocate (omapi_object_t **o, tsize = (*type -> sizer) (size); else tsize = type -> size; - + /* Sanity check. */ if (tsize < sizeof (omapi_object_t)) return DHCP_R_INVALIDARG; - + foo = dmalloc (tsize, file, line); if (!foo) return ISC_R_NOMEMORY; @@ -610,7 +610,7 @@ isc_result_t omapi_object_dereference (omapi_object_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with refcnt of zero!", @@ -624,7 +624,7 @@ isc_result_t omapi_object_dereference (omapi_object_t **h, return DHCP_R_INVALIDARG; #endif } - + /* See if this object's inner object refers to it, but don't count this as a reference if we're being asked to free the reference from the inner object. */ @@ -695,7 +695,7 @@ isc_result_t omapi_object_dereference (omapi_object_t **h, rc_register (file, line, h, hp, 0, 1, hp -> type -> rc_flag); if (handle_reference) { - if (omapi_handle_clear(hp->handle) != + if (omapi_handle_clear(hp->handle) != ISC_R_SUCCESS) { log_debug("Attempt to clear null " "handle pointer"); @@ -729,7 +729,7 @@ isc_result_t omapi_buffer_new (omapi_buffer_t **h, { omapi_buffer_t *t; isc_result_t status; - + t = (omapi_buffer_t *)dmalloc (sizeof *t, file, line); if (!t) return ISC_R_NOMEMORY; @@ -777,7 +777,7 @@ isc_result_t omapi_buffer_dereference (omapi_buffer_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with refcnt of zero!", @@ -912,7 +912,7 @@ isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with refcnt of zero!", @@ -926,7 +926,7 @@ isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h, return DHCP_R_INVALIDARG; #endif } - + --((*h) -> refcnt); rc_register (file, line, h, *h, (*h) -> refcnt, 1, RC_MISC); if ((*h) -> refcnt <= 0 ) { @@ -999,7 +999,7 @@ isc_result_t omapi_data_string_dereference (omapi_data_string_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with refcnt of zero!", @@ -1071,7 +1071,7 @@ isc_result_t omapi_value_dereference (omapi_value_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with refcnt of zero!", @@ -1085,7 +1085,7 @@ isc_result_t omapi_value_dereference (omapi_value_t **h, return DHCP_R_INVALIDARG; #endif } - + --((*h) -> refcnt); rc_register (file, line, h, *h, (*h) -> refcnt, 1, RC_MISC); if ((*h) -> refcnt == 0) { @@ -1153,7 +1153,7 @@ isc_result_t omapi_addr_list_dereference (omapi_addr_list_t **h, return DHCP_R_INVALIDARG; #endif } - + if ((*h) -> refcnt <= 0) { #if defined (POINTER_DEBUG) log_error ("%s(%d): dereference of pointer with zero refcnt!", @@ -1176,4 +1176,3 @@ isc_result_t omapi_addr_list_dereference (omapi_addr_list_t **h, *h = 0; return ISC_R_SUCCESS; } - |