diff options
author | Michael Lentine <mlentine@google.com> | 2014-10-31 15:22:52 -0700 |
---|---|---|
committer | Michael Lentine <mlentine@google.com> | 2014-11-03 13:48:15 -0800 |
commit | 2b8852dececd0ff681e08fe2127d3defb4f73578 (patch) | |
tree | 60e586f136edfa48b1ba4b3d5f40b6ea79c8bfbd /libcutils | |
parent | 4cafe2ff89b49329e0e880900195d8e061bd3750 (diff) | |
download | system_core-2b8852dececd0ff681e08fe2127d3defb4f73578.zip system_core-2b8852dececd0ff681e08fe2127d3defb4f73578.tar.gz system_core-2b8852dececd0ff681e08fe2127d3defb4f73578.tar.bz2 |
Fix native_handle_create to check if malloc fails
Bug: 18076253
Change-Id: I8dbe3af88f52f18f74a3ab857fea53ae7585e2f7
Diffstat (limited to 'libcutils')
-rw-r--r-- | libcutils/native_handle.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libcutils/native_handle.c b/libcutils/native_handle.c index 4089968..9a4a5bb 100644 --- a/libcutils/native_handle.c +++ b/libcutils/native_handle.c @@ -30,9 +30,11 @@ native_handle_t* native_handle_create(int numFds, int numInts) native_handle_t* h = malloc( sizeof(native_handle_t) + sizeof(int)*(numFds+numInts)); - h->version = sizeof(native_handle_t); - h->numFds = numFds; - h->numInts = numInts; + if (h) { + h->version = sizeof(native_handle_t); + h->numFds = numFds; + h->numInts = numInts; + } return h; } |