Fixed another memory leak...

This commit is contained in:
Pavol Marko 2004-05-29 12:18:41 +00:00
parent 9307994060
commit 549e9d6b55

View File

@ -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;
} }