1
0
mirror of https://github.com/fumiama/base16384.git synced 2026-06-21 23:00:24 +08:00

fix(file): incorrect munmap size

This commit is contained in:
源文雨
2024-04-04 21:46:44 +09:00
parent fb9b5c033b
commit 2abcc1489a

8
file.c
View File

@@ -173,11 +173,11 @@ base16384_err_t base16384_encode_file_detailed(const char* input, const char* ou
int n = base16384_encode(input_file, (int)inputsize, decbuf); int n = base16384_encode(input_file, (int)inputsize, decbuf);
if(n && fwrite(decbuf, n, 1, fpo) <= 0) { if(n && fwrite(decbuf, n, 1, fpo) <= 0) {
goto_base16384_file_detailed_cleanup(encode, base16384_err_write_file, { goto_base16384_file_detailed_cleanup(encode, base16384_err_write_file, {
munmap(input_file, (size_t)inputsize); munmap(input_file, (size_t)inputsize+16);
close(fd); close(fd);
}); });
} }
munmap(input_file, (size_t)inputsize); munmap(input_file, (size_t)inputsize+16);
close(fd); close(fd);
} }
#endif #endif
@@ -321,11 +321,11 @@ base16384_err_t base16384_decode_file_detailed(const char* input, const char* ou
int n = base16384_decode(input_file+off, inputsize-off, encbuf); int n = base16384_decode(input_file+off, inputsize-off, encbuf);
if(n && fwrite(encbuf, n, 1, fpo) <= 0) { if(n && fwrite(encbuf, n, 1, fpo) <= 0) {
goto_base16384_file_detailed_cleanup(decode, base16384_err_write_file, { goto_base16384_file_detailed_cleanup(decode, base16384_err_write_file, {
munmap(input_file, (size_t)inputsize); munmap(input_file, (size_t)inputsize+16);
close(fd); close(fd);
}); });
} }
munmap(input_file, (size_t)inputsize); munmap(input_file, (size_t)inputsize+16);
close(fd); close(fd);
} }
#endif #endif