summaryrefslogtreecommitdiffstats
path: root/adb/usb_linux.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-21 19:39:52 -0700
committerElliott Hughes <enh@google.com>2015-04-21 19:43:22 -0700
commitdc3b459ff9f0ff71d404ba7198083e532a0dd894 (patch)
tree3e64efa2fefb22f72fbeb303a672353fb219de16 /adb/usb_linux.cpp
parent9a0cea92c8b74114b70ac3339b2b611633f6a31a (diff)
downloadsystem_core-dc3b459ff9f0ff71d404ba7198083e532a0dd894.zip
system_core-dc3b459ff9f0ff71d404ba7198083e532a0dd894.tar.gz
system_core-dc3b459ff9f0ff71d404ba7198083e532a0dd894.tar.bz2
Add missing null checks after allocations.
Bug: http://b/20317729 Change-Id: I62bb761d48ee59a1f4ddd0cdd0632432305ca2ca
Diffstat (limited to 'adb/usb_linux.cpp')
-rw-r--r--adb/usb_linux.cpp4
1 files changed, 2 insertions, 2 deletions
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 @@ static void register_device(const char *dev_name, const char *devpath,
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;