summaryrefslogtreecommitdiffstats
path: root/adf
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2017-02-16 16:41:27 -0800
committerGreg Hackmann <ghackmann@google.com>2017-02-22 11:07:15 -0800
commit52ae36ed57902508b1440c7ff3570c34e2cf154c (patch)
tree82172dfe86bbd290c1cc068b6d5850b329ec9955 /adf
parent1d73abb4436f5c578f05dd016a820e4a37275f75 (diff)
downloadsystem_core-52ae36ed57902508b1440c7ff3570c34e2cf154c.tar.gz
system_core-52ae36ed57902508b1440c7ff3570c34e2cf154c.tar.bz2
system_core-52ae36ed57902508b1440c7ff3570c34e2cf154c.zip
libadf: adf_test: fix crash on adf.devices failure
If devs is uninitialized and adf_devices() fails, we'll end up passing the uninitialized pointer to free(). Test: /data/nativetest64/adf-unit-tests/adf-unit-tests (on Nexus 9 w/o root) Change-Id: Ifc6038c1da14d32ee564675bac54fc7df2623c1d Signed-off-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'adf')
-rw-r--r--adf/libadf/tests/adf_test.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/adf/libadf/tests/adf_test.cpp b/adf/libadf/tests/adf_test.cpp
index 4727c2b88..82a91f456 100644
--- a/adf/libadf/tests/adf_test.cpp
+++ b/adf/libadf/tests/adf_test.cpp
@@ -188,7 +188,7 @@ const __u32 AdfTest::fmt8888[] = {
const size_t AdfTest::n_fmt8888 = sizeof(fmt8888) / sizeof(fmt8888[0]);
TEST(adf, devices) {
- adf_id_t *devs;
+ adf_id_t *devs = nullptr;
ssize_t n_devs = adf_devices(&devs);
free(devs);