aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c3
-rw-r--r--src/backup.c3
-rw-r--r--src/bitvec.c3
-rw-r--r--src/hash.c3
-rw-r--r--src/pcache1.c6
-rw-r--r--src/vdbetrace.c3
6 files changed, 7 insertions, 14 deletions
diff --git a/src/analyze.c b/src/analyze.c
index 4dfc331be..810ed54d8 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -256,12 +256,11 @@ static void stat3Init(
nRow = (tRowcnt)sqlite3_value_int64(argv[0]);
mxSample = sqlite3_value_int(argv[1]);
n = sizeof(*p) + sizeof(p->a[0])*mxSample;
- p = sqlite3_malloc( n );
+ p = sqlite3MallocZero( n );
if( p==0 ){
sqlite3_result_error_nomem(context);
return;
}
- memset(p, 0, n);
p->a = (struct Stat3Sample*)&p[1];
p->nRow = nRow;
p->mxSample = mxSample;
diff --git a/src/backup.c b/src/backup.c
index 527ecb574..4881215e9 100644
--- a/src/backup.c
+++ b/src/backup.c
@@ -164,7 +164,7 @@ sqlite3_backup *sqlite3_backup_init(
** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a
** call to sqlite3_backup_init() and is destroyed by a call to
** sqlite3_backup_finish(). */
- p = (sqlite3_backup *)sqlite3_malloc(sizeof(sqlite3_backup));
+ p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup));
if( !p ){
sqlite3Error(pDestDb, SQLITE_NOMEM, 0);
}
@@ -172,7 +172,6 @@ sqlite3_backup *sqlite3_backup_init(
/* If the allocation succeeded, populate the new object. */
if( p ){
- memset(p, 0, sizeof(sqlite3_backup));
p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
p->pDest = findBtree(pDestDb, pDestDb, zDestDb);
p->pDestDb = pDestDb;
diff --git a/src/bitvec.c b/src/bitvec.c
index 47d33ea84..8d805a6fe 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -340,10 +340,9 @@ int sqlite3BitvecBuiltinTest(int sz, int *aOp){
/* Allocate the Bitvec to be tested and a linear array of
** bits to act as the reference */
pBitvec = sqlite3BitvecCreate( sz );
- pV = sqlite3_malloc( (sz+7)/8 + 1 );
+ pV = sqlite3MallocZero( (sz+7)/8 + 1 );
pTmpSpace = sqlite3_malloc(BITVEC_SZ);
if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
- memset(pV, 0, (sz+7)/8 + 1);
/* NULL pBitvec tests */
sqlite3BitvecSet(0, 1);
diff --git a/src/hash.c b/src/hash.c
index d4daf92a6..8d5a70656 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -116,14 +116,13 @@ static int rehash(Hash *pH, unsigned int new_size){
** allocation as a benign.
*/
sqlite3BeginBenignMalloc();
- new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) );
+ new_ht = (struct _ht *)sqlite3MallocZero( new_size*sizeof(struct _ht) );
sqlite3EndBenignMalloc();
if( new_ht==0 ) return 0;
sqlite3_free(pH->ht);
pH->ht = new_ht;
pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
- memset(new_ht, 0, new_size*sizeof(struct _ht));
for(elem=pH->first, pH->first=0; elem; elem = next_elem){
unsigned int h = strHash(elem->pKey, elem->nKey) % new_size;
next_elem = elem->next;
diff --git a/src/pcache1.c b/src/pcache1.c
index c41b49e6c..4147d2eff 100644
--- a/src/pcache1.c
+++ b/src/pcache1.c
@@ -396,11 +396,10 @@ static int pcache1ResizeHash(PCache1 *p){
pcache1LeaveMutex(p->pGroup);
if( p->nHash ){ sqlite3BeginBenignMalloc(); }
- apNew = (PgHdr1 **)sqlite3_malloc(sizeof(PgHdr1 *)*nNew);
+ apNew = (PgHdr1 **)sqlite3MallocZero(sizeof(PgHdr1 *)*nNew);
if( p->nHash ){ sqlite3EndBenignMalloc(); }
pcache1EnterMutex(p->pGroup);
if( apNew ){
- memset(apNew, 0, sizeof(PgHdr1 *)*nNew);
for(i=0; i<p->nHash; i++){
PgHdr1 *pPage;
PgHdr1 *pNext = p->apHash[i];
@@ -584,9 +583,8 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
assert( szExtra < 300 );
sz = sizeof(PCache1) + sizeof(PGroup)*separateCache;
- pCache = (PCache1 *)sqlite3_malloc(sz);
+ pCache = (PCache1 *)sqlite3MallocZero(sz);
if( pCache ){
- memset(pCache, 0, sz);
if( separateCache ){
pGroup = (PGroup*)&pCache[1];
pGroup->mxPinned = 10;
diff --git a/src/vdbetrace.c b/src/vdbetrace.c
index c71a7c41a..35825c873 100644
--- a/src/vdbetrace.c
+++ b/src/vdbetrace.c
@@ -169,9 +169,8 @@ void sqlite3ExplainBegin(Vdbe *pVdbe){
if( pVdbe ){
Explain *p;
sqlite3BeginBenignMalloc();
- p = sqlite3_malloc( sizeof(Explain) );
+ p = (Explain *)sqlite3MallocZero( sizeof(Explain) );
if( p ){
- memset(p, 0, sizeof(*p));
p->pVdbe = pVdbe;
sqlite3_free(pVdbe->pExplain);
pVdbe->pExplain = p;