mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Fix double free in osdcmd_do() and clean up the variable definitions while we're there
git-svn-id: https://svn.eduke32.com/eduke32@7084 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4bb9a4b792
commit
03332e8812
1 changed files with 10 additions and 18 deletions
|
@ -9081,24 +9081,20 @@ static int32_t osdcmd_disasm(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
static int32_t osdcmd_do(osdfuncparm_t const * const parm)
|
static int32_t osdcmd_do(osdfuncparm_t const * const parm)
|
||||||
{
|
{
|
||||||
intptr_t oscrofs;
|
|
||||||
char *tp;
|
|
||||||
int32_t i, j, slen, ofs, dontsavehist;
|
|
||||||
int32_t onumconstants=g_numSavedConstants;
|
|
||||||
|
|
||||||
if (parm->numparms==0)
|
if (parm->numparms==0)
|
||||||
return OSDCMD_SHOWHELP;
|
return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
oscrofs = (g_scriptPtr-apScript);
|
int32_t onumconstants = g_numSavedConstants;
|
||||||
|
|
||||||
ofs = 2*(parm->numparms>0); // true if "do" command
|
intptr_t oscrofs = (g_scriptPtr-apScript);
|
||||||
slen = Bstrlen(parm->raw+ofs);
|
int32_t ofs = 2 * (parm->numparms > 0); // true if "do" command
|
||||||
tp = (char *)Xmalloc(slen+2);
|
int32_t slen = Bstrlen(parm->raw + ofs);
|
||||||
|
char * tp = (char *)Xmalloc(slen+2);
|
||||||
|
|
||||||
Bmemcpy(tp, parm->raw+ofs, slen);
|
Bmemcpy(tp, parm->raw+ofs, slen);
|
||||||
|
|
||||||
// M32script call from 'special functions' menu
|
// M32script call from 'special functions' menu
|
||||||
dontsavehist = (slen==0 || tp[0]==' ');
|
int32_t dontsavehist = (slen == 0 || tp[0] == ' ');
|
||||||
|
|
||||||
// needed so that subsequent commands won't execute old stuff.
|
// needed so that subsequent commands won't execute old stuff.
|
||||||
tp[slen] = '\n';
|
tp[slen] = '\n';
|
||||||
|
@ -9109,7 +9105,7 @@ static int32_t osdcmd_do(osdfuncparm_t const * const parm)
|
||||||
C_Compile(tp, 0);
|
C_Compile(tp, 0);
|
||||||
|
|
||||||
if (parm->numparms >= 0)
|
if (parm->numparms >= 0)
|
||||||
Bfree(tp);
|
DO_FREE_AND_NULL(tp);
|
||||||
|
|
||||||
if (g_numCompilerErrors)
|
if (g_numCompilerErrors)
|
||||||
{
|
{
|
||||||
|
@ -9118,10 +9114,6 @@ static int32_t osdcmd_do(osdfuncparm_t const * const parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0,j=0; i<MAXEVENTS; i++)
|
|
||||||
if (aEventOffsets[i]>=0)
|
|
||||||
j++;
|
|
||||||
|
|
||||||
if (g_didDefineSomething == 0)
|
if (g_didDefineSomething == 0)
|
||||||
{
|
{
|
||||||
g_numSavedConstants = onumconstants;
|
g_numSavedConstants = onumconstants;
|
||||||
|
|
Loading…
Reference in a new issue