diff options
author | Elliott Hughes <enh@google.com> | 2015-04-21 19:39:52 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-04-21 19:43:22 -0700 |
commit | dc3b459ff9f0ff71d404ba7198083e532a0dd894 (patch) | |
tree | 3e64efa2fefb22f72fbeb303a672353fb219de16 /adb/services.cpp | |
parent | 9a0cea92c8b74114b70ac3339b2b611633f6a31a (diff) | |
download | system_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/services.cpp')
-rw-r--r-- | adb/services.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/adb/services.cpp b/adb/services.cpp index ff13722..e6c84a4 100644 --- a/adb/services.cpp +++ b/adb/services.cpp @@ -689,6 +689,10 @@ asocket* host_service_to_socket(const char* name, const char *serial) return create_device_tracker(); } else if (!strncmp(name, "wait-for-", strlen("wait-for-"))) { auto sinfo = reinterpret_cast<state_info*>(malloc(sizeof(state_info))); + if (sinfo == nullptr) { + fprintf(stderr, "couldn't allocate state_info: %s", strerror(errno)); + return NULL; + } if (serial) sinfo->serial = strdup(serial); |