mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +00:00
Remove Lmalloc() from nse_pcrelib.cc and change the only call to it to safe_malloc(). I noticed this when I was doing r4515 but wanted to check it a little further; Lmalloc() calls safe_malloc(), and then tests the returned mem == NULL and returns the mem, but this will never happen because safe_malloc() dies if the mem is NULL.
This commit is contained in:
parent
f221d54908
commit
2d8da28206
1 changed files with 1 additions and 10 deletions
|
|
@ -29,15 +29,6 @@ static void L_lua_error(lua_State *L, const char *message)
|
|||
status = lua_error(L);
|
||||
}
|
||||
|
||||
static void *Lmalloc(lua_State *L, size_t size)
|
||||
{
|
||||
void *p = safe_malloc(size);
|
||||
if(p == NULL)
|
||||
L_lua_error(L, "malloc failed");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static int get_startoffset(lua_State *L, int stackpos, size_t len)
|
||||
{
|
||||
int startoffset = luaL_optint(L, stackpos, 1);
|
||||
|
|
@ -159,7 +150,7 @@ static int Lpcre_comp(lua_State *L)
|
|||
|
||||
pcre_fullinfo(ud->pr, ud->extra, PCRE_INFO_CAPTURECOUNT, &ud->ncapt);
|
||||
/* need (2 ints per capture, plus one for substring match) * 3/2 */
|
||||
ud->match = (int *) Lmalloc(L, (ud->ncapt + 1) * 3 * sizeof(int));
|
||||
ud->match = (int *) safe_malloc((ud->ncapt + 1) * 3 * sizeof(int));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue