diff options
author | Yabin Cui <yabinc@google.com> | 2016-02-11 01:41:52 +0100 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-02-11 01:41:52 +0100 |
commit | 71c657a10e39cc99b718fd88784c1437c10fb79e (patch) | |
tree | db80ceb33f745ee7fe076d0d58ce33aa18a7ff47 /install.cpp | |
parent | Merge "IO fault injection for OTA packages" (diff) | |
parent | Fix some memory leaks. (diff) | |
download | android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar.gz android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar.bz2 android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar.lz android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar.xz android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.tar.zst android_bootable_recovery-71c657a10e39cc99b718fd88784c1437c10fb79e.zip |
Diffstat (limited to '')
-rw-r--r-- | install.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/install.cpp b/install.cpp index c0d007709..33c1f5498 100644 --- a/install.cpp +++ b/install.cpp @@ -124,20 +124,20 @@ try_update_binary(const char* path, ZipArchive* zip, bool* wipe_cache) { // - the name of the package zip file. // - const char** args = (const char**)malloc(sizeof(char*) * 5); + const char* args[5]; args[0] = binary; args[1] = EXPAND(RECOVERY_API_VERSION); // defined in Android.mk - char* temp = (char*)malloc(10); - sprintf(temp, "%d", pipefd[1]); + char temp[16]; + snprintf(temp, sizeof(temp), "%d", pipefd[1]); args[2] = temp; - args[3] = (char*)path; + args[3] = path; args[4] = NULL; pid_t pid = fork(); if (pid == 0) { umask(022); close(pipefd[0]); - execv(binary, (char* const*)args); + execv(binary, const_cast<char**>(args)); fprintf(stdout, "E:Can't run %s (%s)\n", binary, strerror(errno)); _exit(-1); } |