From: danielk1977 Date: Mon, 17 Jan 2005 03:40:08 +0000 (+0000) Subject: Fix a memory leak that occurs as a result of an IO error. (CVS 2224) X-Git-Tag: version-3.6.10~3928 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c9cc8d095b57ff9ac489ac5b43c9d6214fa4271;p=thirdparty%2Fsqlite.git Fix a memory leak that occurs as a result of an IO error. (CVS 2224) FossilOrigin-Name: 1edfdcbf142b380172a26d094e6e4a3900db8463 --- diff --git a/manifest b/manifest index 09e5894d54..870999e9fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\ssome\sassert()s\sthat\scould\sfail\sif\sthe\sdatabase\sis\scorrupt\sto\sreturn\sSQLITE_CORRUPT\sinstead.\s(CVS\s2223) -D 2005-01-17T02:12:19 +C Fix\sa\smemory\sleak\sthat\soccurs\sas\sa\sresult\sof\san\sIO\serror.\s(CVS\s2224) +D 2005-01-17T03:40:08 F Makefile.in 78d6d0af3725aef32468ac9923444d7645d21a28 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -74,7 +74,7 @@ F src/update.c 0979397c41ac29c54fe0cc687a356d8629a633af F src/utf.c 9bece2c7b94d9002ab1bb900a7658c6f826b0f74 F src/util.c 03ba0b0b83b14a2ddbc0aaac0681c92c8ebb0b0c F src/vacuum.c 1a9db113a027461daaf44724c71dd1ebbd064203 -F src/vdbe.c a89bb4eefa60226ddfdf8e708ea9352c0a124da3 +F src/vdbe.c c5a711f146415634b72b05212bab9f222b0cce26 F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181 F src/vdbeInt.h f2b5f54d9881bbc89fff02d95f3f825ade68bce2 F src/vdbeapi.c 0cf3bdc1072616bedc8eec7fc22e3f5a169d33fd @@ -267,7 +267,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746 -P feb49d10e83ecc186024d4e96b64ef92cf876715 -R 690aa08ec808e0b8c04e201d95e5a003 +P 2d58c0afa769d49c8819ea4982bc20ae39516f97 +R 5225b78fe98ecaba4ad353b32e187f8c U danielk1977 -Z 422777f924a69fbf76ec890646525100 +Z fe4ca27f9035b326974cf8c4ecac5357 diff --git a/manifest.uuid b/manifest.uuid index 2ee48bd306..2825989231 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d58c0afa769d49c8819ea4982bc20ae39516f97 \ No newline at end of file +1edfdcbf142b380172a26d094e6e4a3900db8463 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 5389557ad3..2ffaa5e295 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.442 2005/01/12 09:10:40 danielk1977 Exp $ +** $Id: vdbe.c,v 1.443 2005/01/17 03:40:08 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -1825,7 +1825,7 @@ case OP_Column: { if( !zRec && availkeyAsData, &sMem); if( rc!=SQLITE_OK ){ - goto abort_due_to_error; + goto op_column_out; } zData = sMem.z; } @@ -1851,10 +1851,8 @@ case OP_Column: { ** we are dealing with a malformed record. */ if( idx!=szHdr || offset!=payloadSize ){ - sqliteFree(aType); - if( pC ) pC->aType = 0; rc = SQLITE_CORRUPT; - break; + goto op_column_out; } /* Remember all aType and aColumn information if we have a cursor @@ -1876,7 +1874,7 @@ case OP_Column: { len = sqlite3VdbeSerialTypeLen(aType[p2]); rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->keyAsData, &sMem); if( rc!=SQLITE_OK ){ - goto abort_due_to_error; + goto op_column_out; } zData = sMem.z; } @@ -1901,8 +1899,9 @@ case OP_Column: { ** can abandon sMem */ rc = sqlite3VdbeMemMakeWriteable(pTos); +op_column_out: /* Release the aType[] memory if we are not dealing with cursor */ - if( !pC ){ + if( !pC || !pC->aType ){ sqliteFree(aType); } break;