mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-12-01 13:24:25 +01:00
InterfaceSearch no longer uses new[]
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40284
This commit is contained in:
parent
941d4c066f
commit
1d8a6f49f1
@ -334,14 +334,23 @@ int CSmmAPI::FormatIface(char iface[], unsigned int maxlength)
|
||||
|
||||
void *CSmmAPI::InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret)
|
||||
{
|
||||
char _if[256]; /* assume no interface goes beyond this */
|
||||
size_t len = strlen(iface);
|
||||
int num = 0;
|
||||
void *pf = NULL;
|
||||
char *_if = new char[len + 2];
|
||||
|
||||
if (max > 999)
|
||||
max = 999;
|
||||
|
||||
if (len + 4 > sizeof(_if))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
*ret = IFACE_FAILED;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(_if, iface);
|
||||
|
||||
do
|
||||
@ -352,8 +361,6 @@ void *CSmmAPI::InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max,
|
||||
break;
|
||||
} while (( num = FormatIface(_if, len+1) ));
|
||||
|
||||
delete[] _if;
|
||||
|
||||
return pf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user