CodeQL MemoryMayNotBeFreed.ql rtrCmd.c CmdRoute()
This commit is contained in:
parent
cb9333804a
commit
b5d068b0ea
|
|
@ -1134,11 +1134,20 @@ windDoMacro(w, cmd, interactive)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cn = NULL;
|
||||||
any = FALSE;
|
any = FALSE;
|
||||||
ch = 0;
|
ch = 0;
|
||||||
HashStartSearch(&hs);
|
HashStartSearch(&hs);
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
if (cn)
|
||||||
|
{
|
||||||
|
/* this loop uses 'continue' after 'cn' was assigned from malloc below, so
|
||||||
|
* this ensures it is freed up at the start of the next iteration.
|
||||||
|
*/
|
||||||
|
freeMagic(cn);
|
||||||
|
cn = NULL;
|
||||||
|
}
|
||||||
h = HashNext(clienttable, &hs);
|
h = HashNext(clienttable, &hs);
|
||||||
if (h == NULL) break;
|
if (h == NULL) break;
|
||||||
cMacro = (macrodef *) HashGetValue(h);
|
cMacro = (macrodef *) HashGetValue(h);
|
||||||
|
|
@ -1186,7 +1195,6 @@ windDoMacro(w, cmd, interactive)
|
||||||
TxPrintf("Macro '%s' %s \"%s\"\n",
|
TxPrintf("Macro '%s' %s \"%s\"\n",
|
||||||
cn, (do_help) ? "" : "contains", cp);
|
cn, (do_help) ? "" : "contains", cp);
|
||||||
}
|
}
|
||||||
freeMagic(cn);
|
|
||||||
any = TRUE;
|
any = TRUE;
|
||||||
}
|
}
|
||||||
if (!any)
|
if (!any)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue