From 6c6808235993d6075b0196f75bb5d7a52ff2e372 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 4 Jul 2011 01:57:19 -0700 Subject: [PATCH] Fix crash when dynamic arrays run out of memory (bug 4632, r=fyren). --- sourcepawn/jit/x86/jit_x86.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 01cc2018..69f2a854 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -2544,17 +2544,7 @@ bool JITX86::InitializeJIT() jit = &writer; - /* Build the genarray intrinsic */ - jit->outbase = NULL; - jit->outptr = NULL; - WriteIntrinsic_GenArray(jit); - m_pJitGenArray = Knight::KE_AllocCode(g_pCodeCache, jit->get_outputpos()); - jit->outbase = (jitcode_t)m_pJitGenArray; - jit->outptr = jit->outbase; - WriteIntrinsic_GenArray(jit); - /* Build the entry point */ - writer = JitWriter(); jit->outbase = NULL; jit->outptr = NULL; Write_Execute_Function(jit); @@ -2564,6 +2554,16 @@ bool JITX86::InitializeJIT() offs = Write_Execute_Function(jit); m_pJitReturn = (uint8_t *)m_pJitEntry + offs; + /* Build the genarray intrinsic */ + writer = JitWriter(); + jit->outbase = NULL; + jit->outptr = NULL; + WriteIntrinsic_GenArray(jit); + m_pJitGenArray = Knight::KE_AllocCode(g_pCodeCache, jit->get_outputpos()); + jit->outbase = (jitcode_t)m_pJitGenArray; + jit->outptr = jit->outbase; + WriteIntrinsic_GenArray(jit); + return true; }