aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-09-11 16:15:55 +0000
committerdrh <drh@noemail.net>2010-09-11 16:15:55 +0000
commit71a1a0f485fb64e5996a6edfe1534e66a7e74add (patch)
tree907f9c3ff46ffc0561fd43146cbdec3aa8aaaa3f /src/malloc.c
parent1567acf96ac2eb84d65e122168dc749fad4b028d (diff)
downloadsqlite-71a1a0f485fb64e5996a6edfe1534e66a7e74add.tar.gz
sqlite-71a1a0f485fb64e5996a6edfe1534e66a7e74add.zip
Additional evidence marks on the malloc() implementation. Update the
documentation to explain that mallocs are not necessarily 8-byte aligned if the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option is used. FossilOrigin-Name: 42b4bf9e72501cf228b4086437c7660443933f74
Diffstat (limited to 'src/malloc.c')
-rw-r--r--src/malloc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 948eb91d1..d7a103b11 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -293,7 +293,9 @@ static int mallocWithAlarm(int n, void **pp){
*/
void *sqlite3Malloc(int n){
void *p;
- if( n<=0 || n>=0x7fffff00 ){
+ if( n<=0 /* IMP: R-65312-04917 */
+ || n>=0x7fffff00
+ ){
/* A memory allocation of a number of bytes which is near the maximum
** signed integer value might cause an integer overflow inside of the
** xMalloc(). Hence we limit the maximum size to 0x7fffff00, giving
@@ -459,7 +461,7 @@ int sqlite3DbMallocSize(sqlite3 *db, void *p){
** Free memory previously obtained from sqlite3Malloc().
*/
void sqlite3_free(void *p){
- if( p==0 ) return;
+ if( p==0 ) return; /* IMP: R-49053-54554 */
assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
if( sqlite3GlobalConfig.bMemstat ){
@@ -506,10 +508,10 @@ void *sqlite3Realloc(void *pOld, int nBytes){
int nOld, nNew;
void *pNew;
if( pOld==0 ){
- return sqlite3Malloc(nBytes);
+ return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */
}
if( nBytes<=0 ){
- sqlite3_free(pOld);
+ sqlite3_free(pOld); /* IMP: R-31593-10574 */
return 0;
}
if( nBytes>=0x7fffff00 ){