Add missing null checks after allocations.

Bug: http://b/20317729
Change-Id: I62bb761d48ee59a1f4ddd0cdd0632432305ca2ca
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 58e1ade..c503558 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -312,6 +312,7 @@
 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 @@
     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;