Some cleanups in isc mem code (#38896)

(cherry picked from commit fba894c98b)
(cherry picked from commit 8bf3c4972b)
This commit is contained in:
Mukund Sivaraman 2015-03-27 23:09:28 +05:30
parent c04823752a
commit ea42d94d51
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,5 @@
4091. [cleanup] Some cleanups in isc mem code. [RT #38896]
4090. [bug] Fix a crash while parsing malformed CAA RRs in
presentation format, i.e., from text such as
from master files. Thanks to John Van de

View file

@ -661,7 +661,7 @@ mem_getunlocked(isc__mem_t *ctx, size_t size) {
size_t new_size = quantize(size);
void *ret;
if (size >= ctx->max_size || new_size >= ctx->max_size) {
if (new_size >= ctx->max_size) {
/*
* memget() was called on something beyond our upper limit.
*/
@ -741,7 +741,7 @@ static inline void
mem_putunlocked(isc__mem_t *ctx, void *mem, size_t size) {
size_t new_size = quantize(size);
if (size == ctx->max_size || new_size >= ctx->max_size) {
if (new_size >= ctx->max_size) {
/*
* memput() called on something beyond our upper limit.
*/
@ -1093,11 +1093,17 @@ destroy(isc__mem_t *ctx) {
if (ctx->checkfree) {
for (i = 0; i <= ctx->max_size; i++) {
if (ctx->stats[i].gets != 0U) {
fprintf(stderr,
"Failing assertion due to probable "
"leaked memory in context %p (\"%s\") "
"(stats[%u].gets == %lu).\n",
ctx, ctx->name, i, ctx->stats[i].gets);
#if ISC_MEM_TRACKLINES
if (ctx->stats[i].gets != 0U)
print_active(ctx, stderr);
#endif
INSIST(ctx->stats[i].gets == 0U);
INSIST(ctx->stats[i].gets == 0U);
}
}
}