summaryrefslogtreecommitdiffstats
path: root/adb/commandline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'adb/commandline.cpp')
-rw-r--r--adb/commandline.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index e76c341..e59a96a 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -312,6 +312,7 @@ static void read_status_line(int fd, char* buf, size_t count)
static void copy_to_file(int inFd, int outFd) {
const size_t BUFSIZE = 32 * 1024;
char* buf = (char*) malloc(BUFSIZE);
+ if (buf == nullptr) fatal("couldn't allocate buffer for copy_to_file");
int len;
long total = 0;
@@ -419,6 +420,11 @@ static int interactive_shell() {
fdi = 0; //dup(0);
int* fds = reinterpret_cast<int*>(malloc(sizeof(int) * 2));
+ if (fds == nullptr) {
+ fprintf(stderr, "couldn't allocate fds array: %s\n", strerror(errno));
+ return 1;
+ }
+
fds[0] = fd;
fds[1] = fdi;