More stack->heap

This commit is contained in:
Adam Ierymenko 2019-06-17 15:28:02 -07:00
parent e2900f4f3c
commit c5a07c7f20

View file

@ -2455,12 +2455,17 @@ public:
// little effect on others. // little effect on others.
f = fopen(p,"rb"); f = fopen(p,"rb");
if (f) { if (f) {
char buf[65535]; char *const buf = (char *)malloc(len*4);
long l = (long)fread(buf,1,sizeof(buf),f); if (buf) {
long l = (long)fread(buf,1,(size_t)(len*4),f);
fclose(f); fclose(f);
if ((l == (long)len)&&(memcmp(data,buf,l) == 0)) if ((l == (long)len)&&(memcmp(data,buf,l) == 0)) {
free(buf);
return; return;
} }
free(buf);
}
}
f = fopen(p,"wb"); f = fopen(p,"wb");
if ((!f)&&(dirname[0])) { // create subdirectory if it does not exist if ((!f)&&(dirname[0])) { // create subdirectory if it does not exist