diff options
author | Marco Nelissen <marcone@google.com> | 2015-04-28 13:47:27 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-04-28 13:47:27 -0700 |
commit | 4c3ba337bacce05165d37f63dfa0b7e845c391e0 (patch) | |
tree | e65e3a9eb9e4ab52a37cc316d6e7aa48ef387f32 | |
parent | 466dc8ed6ca6b7f585104806c48613dd34e608c9 (diff) | |
download | frameworks_av-4c3ba337bacce05165d37f63dfa0b7e845c391e0.zip frameworks_av-4c3ba337bacce05165d37f63dfa0b7e845c391e0.tar.gz frameworks_av-4c3ba337bacce05165d37f63dfa0b7e845c391e0.tar.bz2 |
Check allocation
Bug: 20222446
Change-Id: I2f366a907886cd65e12a6f260a2ec77af6fb7b41
-rw-r--r-- | media/libmedia/IHDCP.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp index 79944ee..f3a8902 100644 --- a/media/libmedia/IHDCP.cpp +++ b/media/libmedia/IHDCP.cpp @@ -284,11 +284,17 @@ status_t BnHDCP::onTransact( size_t offset = data.readInt32(); size_t size = data.readInt32(); uint32_t streamCTR = data.readInt32(); - void *outData = malloc(size); + void *outData = NULL; uint64_t inputCTR; - status_t err = encryptNative(graphicBuffer, offset, size, - streamCTR, &inputCTR, outData); + status_t err = ERROR_OUT_OF_RANGE; + + outData = malloc(size); + + if (outData != NULL) { + err = encryptNative(graphicBuffer, offset, size, + streamCTR, &inputCTR, outData); + } reply->writeInt32(err); |