mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-03-01 22:29:15 +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)
|
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);
|
size_t len = strlen(iface);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
void *pf = NULL;
|
void *pf = NULL;
|
||||||
char *_if = new char[len + 2];
|
|
||||||
|
|
||||||
if (max > 999)
|
if (max > 999)
|
||||||
max = 999;
|
max = 999;
|
||||||
|
|
||||||
|
if (len + 4 > sizeof(_if))
|
||||||
|
{
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
*ret = IFACE_FAILED;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(_if, iface);
|
strcpy(_if, iface);
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -352,8 +361,6 @@ void *CSmmAPI::InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max,
|
|||||||
break;
|
break;
|
||||||
} while (( num = FormatIface(_if, len+1) ));
|
} while (( num = FormatIface(_if, len+1) ));
|
||||||
|
|
||||||
delete[] _if;
|
|
||||||
|
|
||||||
return pf;
|
return pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user