Fully initialize the unused bytes of the buffer that will become the journal

file header, in order to silence a complaint from valgrind. (CVS 5968)

FossilOrigin-Name: 2822cbb960dbef9d30586ee112d74f9f566309fa
This commit is contained in:
drh 2008-11-29 22:49:23 +00:00
parent 9b35ea62c7
commit 08609ce7f0
3 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Continuing\sto\srefactor\sos_unix.c.\s\sThis\sis\san\sincremental\scheck-in.\s(CVS\s5967)
D 2008-11-29T02:20:27
C Fully\sinitialize\sthe\sunused\sbytes\sof\sthe\sbuffer\sthat\swill\sbecome\sthe\sjournal\nfile\sheader,\sin\sorder\sto\ssilence\sa\scomplaint\sfrom\svalgrind.\s(CVS\s5968)
D 2008-11-29T22:49:23
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -139,7 +139,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c 36196e71292a44bf2d393413cd8c86199694b8b4
F src/os_unix.c a5c0e3fe58b85c81fafd16f8c663c931ba38b364
F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb
F src/pager.c 2e9182e181bbd3d758436d9ccce2a3910400dd30
F src/pager.c a193da9e271898077de815819e4c29fc2b6ece2a
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
F src/pcache.c f3121a531745b20f5b824201eb63949a7e2959ac
@ -662,7 +662,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 1017d2fb1935a278ef442030bf7bdf5e112c566a
R f00e6eb8b99e6b851224a95474513114
P c13df0311ef4f6a510f42105293f7c53c323fda8
R 8f4049d4800c1bce4b230f75c529f535
U drh
Z f1b7704edc33398e54a65a32044b4ee1
Z 48d2f21fdd87c9f5450fa6c5be78ab32

View File

@ -1 +1 @@
c13df0311ef4f6a510f42105293f7c53c323fda8
2822cbb960dbef9d30586ee112d74f9f566309fa

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.509 2008/11/26 07:25:52 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.510 2008/11/29 22:49:23 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@ -681,6 +681,15 @@ static int writeJournalHdr(Pager *pPager){
put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
/* The assumed sector size for this process */
put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);
/* Initializing the tail of the buffer is not necessary. Everything
** works find if the following memset() is omitted. But initializing
** the memory prevents valgrind from complaining, so we are willing to
** take the performance hit.
*/
memset(&zHeader[sizeof(aJournalMagic)+16], 0,
nHeader-(sizeof(aJournalMagic)+16));
if( pPager->journalHdr==0 ){
/* The page size */
put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);