diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2012-01-18 17:58:19 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-01-18 17:58:19 -0800 |
commit | 9883083afdb09845b0364f04c18d4fff24a89036 (patch) | |
tree | 6a7c1060ae2cca058192279b7bb7c10cea7c2366 | |
parent | b30136b7f51858db1a3272bf91801fe7faf16309 (diff) | |
parent | 412d55c7ee5ce42dc52e0c03c3e0d1c5c2d9d870 (diff) | |
download | extras-9883083afdb09845b0364f04c18d4fff24a89036.tar.gz |
am 412d55c7: Merge "fix fd leaking and deallocation freed resource"
* commit '412d55c7ee5ce42dc52e0c03c3e0d1c5c2d9d870':
fix fd leaking and deallocation freed resource
-rw-r--r-- | ext4_utils/ext4_utils.c | 1 | ||||
-rw-r--r-- | ext4_utils/output_file.c | 5 |
2 files changed, 2 insertions, 4 deletions
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c index d41b92d5..3d5895e3 100644 --- a/ext4_utils/ext4_utils.c +++ b/ext4_utils/ext4_utils.c @@ -460,6 +460,7 @@ static u64 get_block_device_size(const char *filename) #elif defined(__APPLE__) && defined(__MACH__) ret = ioctl(fd, DKIOCGETBLOCKCOUNT, &size); #else + close(fd); return 0; #endif diff --git a/ext4_utils/output_file.c b/ext4_utils/output_file.c index 39a6007b..d7cf91bc 100644 --- a/ext4_utils/output_file.c +++ b/ext4_utils/output_file.c @@ -355,6 +355,7 @@ struct output_file *open_output_file(const char *filename, int gz, int sparse, zero_buf = malloc(info.block_size); if (!zero_buf) { error_errno("malloc zero_buf"); + free(out); return NULL; } memset(zero_buf, '\0', info.block_size); @@ -547,10 +548,6 @@ void write_data_file(struct output_file *out, u64 off, const char *file, goto err; } - munmap(data, len); - - close(file_fd); - err: munmap(data, len); close(file_fd); |