Add missing null checks after allocations.
Bug: http://b/20317729
Change-Id: I62bb761d48ee59a1f4ddd0cdd0632432305ca2ca
diff --git a/adb/usb_linux.cpp b/adb/usb_linux.cpp
index 6fd2b40..9f23511 100644
--- a/adb/usb_linux.cpp
+++ b/adb/usb_linux.cpp
@@ -598,8 +598,8 @@
D("[ usb located new device %s (%d/%d/%d) ]\n",
dev_name, ep_in, ep_out, interface);
- usb_handle* usb = reinterpret_cast<usb_handle*>(
- calloc(1, sizeof(usb_handle)));
+ usb_handle* usb = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle)));
+ if (usb == nullptr) fatal("couldn't allocate usb_handle");
strcpy(usb->fname, dev_name);
usb->ep_in = ep_in;
usb->ep_out = ep_out;