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:
8
file.c
8
file.c
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user