mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-14 04:10:06 +01:00
Do not copy buffer if read fails.
This commit is contained in:
@@ -184,6 +184,7 @@ ssize_t read_blockwise(int fd, size_t bsize, size_t alignment,
|
|||||||
out:
|
out:
|
||||||
free(hangover_buf);
|
free(hangover_buf);
|
||||||
if (buf != orig_buf) {
|
if (buf != orig_buf) {
|
||||||
|
if (ret == length)
|
||||||
memcpy(orig_buf, buf, length);
|
memcpy(orig_buf, buf, length);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user