summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2013-10-29 16:12:46 -0500
committerElliott Hughes2013-10-29 16:12:46 -0500
commit14e28d39f7f094225c1ddae8fa43bd792c621a8f (patch)
treef4d986698864a59ea87af253247753768916be37 /libsparse
parent98f87d92d89079f274374409efcf57ca52b13c1f (diff)
downloadplatform-system-core-14e28d39f7f094225c1ddae8fa43bd792c621a8f.tar.gz
platform-system-core-14e28d39f7f094225c1ddae8fa43bd792c621a8f.tar.xz
platform-system-core-14e28d39f7f094225c1ddae8fa43bd792c621a8f.zip
Fix a bunch of small system/core bugs.
Missing frees in: adb/file_sync_client.c fastboot/fastboot.c libsparse/output_file.c Missing closedirs in: adb/file_sync_service.c cpio/mkbootfs.c libcutils/dir_hash.c Potential buffer overrun in: gpttool/gpttool.c Incorrect NULL check in: libsparse/backed_block.c Bug: https://code.google.com/p/android/issues/detail?id=61564 Change-Id: If97838a9e73a77aef7f416c31c237ce1fca4ce21
Diffstat (limited to 'libsparse')
-rw-r--r--libsparse/backed_block.c2
-rw-r--r--libsparse/output_file.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/libsparse/backed_block.c b/libsparse/backed_block.c
index dfb217b30..3e72b57c7 100644
--- a/libsparse/backed_block.c
+++ b/libsparse/backed_block.c
@@ -370,7 +370,7 @@ int backed_block_split(struct backed_block_list *bbl, struct backed_block *bb,
370 } 370 }
371 371
372 new_bb = malloc(sizeof(struct backed_block)); 372 new_bb = malloc(sizeof(struct backed_block));
373 if (bb == NULL) { 373 if (new_bb == NULL) {
374 return -ENOMEM; 374 return -ENOMEM;
375 } 375 }
376 376
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index 24280227e..a28b0a5ad 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -722,10 +722,12 @@ int write_fd_chunk(struct output_file *out, unsigned int len,
722 } 722 }
723 pos = lseek64(fd, offset, SEEK_SET); 723 pos = lseek64(fd, offset, SEEK_SET);
724 if (pos < 0) { 724 if (pos < 0) {
725 free(data);
725 return -errno; 726 return -errno;
726 } 727 }
727 ret = read_all(fd, data, len); 728 ret = read_all(fd, data, len);
728 if (ret < 0) { 729 if (ret < 0) {
730 free(data);
729 return ret; 731 return ret;
730 } 732 }
731 ptr = data; 733 ptr = data;