Fix a memory leak that can occur when the library API is misused. (CVS 4932)

FossilOrigin-Name: 2b6d3e015e3088531c62230c9b3bdab47ef534da
This commit is contained in:
danielk1977 2008-03-28 19:16:33 +00:00
parent f934c5a98b
commit 75eb016666
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Do\snot\sincorrectly\sreport\sa\smalloc()\sfailure\swhen\sallocating\s0\sbytes.\sFixes\sa\sproblem\sin\sbind.test.\s(CVS\s4931)
D 2008-03-28T19:15:35
C Fix\sa\smemory\sleak\sthat\scan\soccur\swhen\sthe\slibrary\sAPI\sis\smisused.\s(CVS\s4932)
D 2008-03-28T19:16:34
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in cf434ce8ca902e69126ae0f94fc9f7dc7428a5fa
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -174,7 +174,7 @@ F src/update.c 2aefd3c9277792e9fa2414dfe14202119fa49fe7
F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
F src/util.c dba9e04121eb17ec4643d6ca231ff859452cf0e2
F src/vacuum.c 3524411bfb58aac0d87eadd3e5b7cd532772af30
F src/vdbe.c a1413f2dd70718cbea922ae58828426504b1184a
F src/vdbe.c 09dd6f4c5e69f17f7633d22e3f45edbafe83eeaf
F src/vdbe.h f72201a0657d5f3d6cc008d1f8d9cc65768518c9
F src/vdbeInt.h 0b96efdeecb0803e504bf1c16b198f87c91d6019
F src/vdbeapi.c e03b846adf7fb938b3945019dc6c4c49ed86bb0e
@ -619,7 +619,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P bce289753538ab504e55c4215d6cd4f5df137d9e
R 151801c4131b431f075bc00e1e6e7959
P b99d19d651b00dcc7bdb36facfd9ecffe4fafd9f
R e62394b42b597cc4853ef813c5823149
U danielk1977
Z b54117baecd9504186f4be258a073860
Z 5f5565eaa0d6e1fc9e5636f169e9e042

View File

@ -1 +1 @@
b99d19d651b00dcc7bdb36facfd9ecffe4fafd9f
2b6d3e015e3088531c62230c9b3bdab47ef534da

View File

@ -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.721 2008/03/28 15:44:10 danielk1977 Exp $
** $Id: vdbe.c,v 1.722 2008/03/28 19:16:34 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -1290,7 +1290,10 @@ case OP_Function: {
}
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
(*ctx.pFunc->xFunc)(&ctx, n, apVal);
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
if( sqlite3SafetyOn(db) ){
sqlite3VdbeMemRelease(&ctx.s);
goto abort_due_to_misuse;
}
if( db->mallocFailed ){
/* Even though a malloc() has failed, the implementation of the
** user function may have called an sqlite3_result_XXX() function