mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fixed another memory leak...
This commit is contained in:
parent
9307994060
commit
549e9d6b55
@ -299,9 +299,10 @@ static cell AMX_NATIVE_CALL amx_fread(AMX *amx, cell *params)
|
|||||||
FILE *fp = (FILE *)params[1];
|
FILE *fp = (FILE *)params[1];
|
||||||
char *buffer;
|
char *buffer;
|
||||||
if (fp) {
|
if (fp) {
|
||||||
buffer = new char[params[3]];
|
buffer = new char[params[3]]; // SLOW!!! :TODO: Find a better way (auto pointers?)
|
||||||
fread(buffer, sizeof(char), params[3], fp);
|
fread(buffer, sizeof(char), params[3], fp);
|
||||||
return set_amxstring(amx, params[2], buffer, params[3]);
|
return set_amxstring(amx, params[2], buffer, params[3]);
|
||||||
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user