summaryrefslogtreecommitdiff
path: root/libs/utils/BackupHelpers.cpp
diff options
context:
space:
mode:
author Iliyan Malchev <malchev@google.com> 2012-02-17 12:15:58 -0800
committer Iliyan Malchev <malchev@google.com> 2012-02-17 14:27:13 -0800
commit6032a7768227c5c54eee15b253f9cbb14e62039d (patch)
tree4349990ab1edfba95ec6166e2b37862fa6883d71 /libs/utils/BackupHelpers.cpp
parenta4fb1682edc49cc47e899d66d1dfaedf0ac40c4c (diff)
libs/utils: replace malloc() + memset() to zero with calloc()
Change-Id: I8bdf4360147e51e35c162856c9a859aed6acac34 Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'libs/utils/BackupHelpers.cpp')
-rw-r--r--libs/utils/BackupHelpers.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp
index f77a8917c7..214f6d7e91 100644
--- a/libs/utils/BackupHelpers.cpp
+++ b/libs/utils/BackupHelpers.cpp
@@ -546,7 +546,7 @@ int write_tarfile(const String8& packageName, const String8& domain,
// read/write up to this much at a time.
const size_t BUFSIZE = 32 * 1024;
- char* buf = new char[BUFSIZE];
+ char* buf = (char *)calloc(1,BUFSIZE);
char* paxHeader = buf + 512; // use a different chunk of it as separate scratch
char* paxData = buf + 1024;
@@ -556,9 +556,6 @@ int write_tarfile(const String8& packageName, const String8& domain,
goto cleanup;
}
- // Good to go -- first construct the standard tar header at the start of the buffer
- memset(buf, 0, BUFSIZE);
-
// Magic fields for the ustar file format
strcat(buf + 257, "ustar");
strcat(buf + 263, "00");