Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52ae36ed authored by Greg Hackmann's avatar Greg Hackmann
Browse files

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: default avatarGreg Hackmann <ghackmann@google.com>
parent 1d73abb4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);