git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Copyright updates:
[exim.git]
/
src
/
src
/
store.c
diff --git
a/src/src/store.c
b/src/src/store.c
index 1e555cc18588ac4ec723b4249697023149f018f7..684f83cf0c27557937aa058e1060211616b0bbeb 100644
(file)
--- a/
src/src/store.c
+++ b/
src/src/store.c
@@
-2,9
+2,10
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim maintainers 2019 - 2023 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim maintainers 2019 - 2021 */
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Exim gets and frees all its store through these functions. In the original
implementation there was a lot of mallocing and freeing of small bits of store.
/* Exim gets and frees all its store through these functions. In the original
implementation there was a lot of mallocing and freeing of small bits of store.
@@
-259,7
+260,7
@@
return NULL;
}
static pooldesc *
}
static pooldesc *
-pool_for_pointer(const void * p)
+pool_for_pointer(const void * p
, const char * func, int linenumber
)
{
pooldesc * pp;
storeblock * b;
{
pooldesc * pp;
storeblock * b;
@@
-274,7
+275,11
@@
for (pp = paired_pools; pp < paired_pools + N_PAIRED_POOLS; pp++)
for (b = pp->chainbase; b; b = b->next)
if (is_pointer_in_block(b, p)) return pp;
for (b = pp->chainbase; b; b = b->next)
if (is_pointer_in_block(b, p)) return pp;
-log_write(0, LOG_MAIN|LOG_PANIC_DIE, "bad memory reference; pool not found");
+#ifndef COMPILE_UTILITY
+stackdump();
+#endif
+log_write(0, LOG_MAIN|LOG_PANIC_DIE,
+ "bad memory reference; pool not found, at %s %d", func, linenumber);
return NULL;
}
return NULL;
}
@@
-379,7
+384,7
@@
allocated store. */
if (size < 0 || size >= INT_MAX/2)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
if (size < 0 || size >= INT_MAX/2)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
- "bad memory allocation requested (%d bytes)
at
%s %d",
+ "bad memory allocation requested (%d bytes)
from
%s %d",
size, func, linenumber);
/* Round up the size to a multiple of the alignment. Although this looks a
size, func, linenumber);
/* Round up the size to a multiple of the alignment. Although this looks a
@@
-713,7
+718,7
@@
BOOL
store_extend_3(void * ptr, int oldsize, int newsize,
const char * func, int linenumber)
{
store_extend_3(void * ptr, int oldsize, int newsize,
const char * func, int linenumber)
{
-pooldesc * pp = pool_for_pointer(ptr);
+pooldesc * pp = pool_for_pointer(ptr
, func, linenumber
);
int inc = newsize - oldsize;
int rounded_oldsize = oldsize;
int inc = newsize - oldsize;
int rounded_oldsize = oldsize;
@@
-1105,7
+1110,7
@@
void *
store_newblock_3(void * oldblock, int newsize, int len,
const char * func, int linenumber)
{
store_newblock_3(void * oldblock, int newsize, int len,
const char * func, int linenumber)
{
-pooldesc * pp = pool_for_pointer(oldblock);
+pooldesc * pp = pool_for_pointer(oldblock
, func, linenumber
);
BOOL release_ok = !is_tainted(oldblock) && pp->store_last_get == oldblock; /*XXX why tainted not handled? */
uschar * newblock;
BOOL release_ok = !is_tainted(oldblock) && pp->store_last_get == oldblock; /*XXX why tainted not handled? */
uschar * newblock;
@@
-1149,8
+1154,8
@@
a negative int, to the (unsigned, wider) size_t */
if (size >= INT_MAX/2)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
if (size >= INT_MAX/2)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
-
"bad memory allocation requested (" SIZE_T_FMT " bytes) at
%s %d",
-
size, func, line);
+
"bad internal_store_malloc request (" SIZE_T_FMT " bytes) from
%s %d",
+ size, func, line);
size += sizeof(size_t); /* space to store the size, used under debug */
if (size < 16) size = 16;
size += sizeof(size_t); /* space to store the size, used under debug */
if (size < 16) size = 16;