2006-11-28 05:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/compiler/harbour.c
    ! fixed typo in last modification which caused memory leak

  * harbour/source/vm/codebloc.c
    + initialize freed codeblock structure with pointer to static PCODE
      which returns NIL for buggy .prg destructors.

  * harbour/ChangeLog
    ! fixed date of my last commit
This commit is contained in:
Przemyslaw Czerpak
2006-11-28 04:41:45 +00:00
parent 33ccad6661
commit e79392e512
3 changed files with 22 additions and 4 deletions

View File

@@ -8,7 +8,18 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2006-11-27 02:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
2006-11-28 05:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/compiler/harbour.c
! fixed typo in last modification which caused memory leak
* harbour/source/vm/codebloc.c
+ initialize freed codeblock structure with pointer to static PCODE
which returns NIL for buggy .prg destructors.
* harbour/ChangeLog
! fixed date of my last commit
2006-11-28 02:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/tests/codebl.prg
* harbour/tests/langmsg.prg
* harbour/utils/hbpptest/pp_test.prg

View File

@@ -4522,14 +4522,13 @@ static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile )
if( HB_COMP_PARAM->pInitFunc )
{
PCOMSYMBOL pSym;
char * szNewName;
char szNewName[ 25 ];
/* Fix the number of static variables */
HB_COMP_PARAM->pInitFunc->pCode[ 3 ] = HB_LOBYTE( HB_COMP_PARAM->iStaticCnt );
HB_COMP_PARAM->pInitFunc->pCode[ 4 ] = HB_HIBYTE( HB_COMP_PARAM->iStaticCnt );
HB_COMP_PARAM->pInitFunc->iStaticsBase = HB_COMP_PARAM->iStaticCnt;
/* Update pseudo function name */
szNewName = ( char * ) hb_xgrab( 25 );
sprintf( szNewName, "(_INITSTATICS%05d)", HB_COMP_PARAM->iStaticCnt );
HB_COMP_PARAM->pInitFunc->szName = hb_compIdentifierNew( HB_COMP_PARAM, szNewName, HB_IDENT_COPY );

View File

@@ -57,6 +57,13 @@
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbpcode.h"
/* Dummy returning NIL for buggy code which may store references
to freed by GC codeblock in .prg destructors and then (after
catching RT EG_DESTRUCTOR error) try to execute them
*/
static const BYTE s_pCode[] = { HB_P_PUSHNIL, HB_P_ENDBLOCK };
/* Release all allocated memory when called from the garbage collector
*/
@@ -70,9 +77,10 @@ static HB_GARBAGE_FUNC( hb_codeblockDeleteGarbage )
*/
if( pCBlock->pCode && pCBlock->dynBuffer )
{
pCBlock->dynBuffer = FALSE;
hb_xfree( pCBlock->pCode );
pCBlock->pCode = NULL;
}
pCBlock->pCode = ( BYTE * ) s_pCode;
/* free space allocated for local variables
*/