Skip to content

Commit

Permalink
Fix for coverity issue for memtrack_module
Browse files Browse the repository at this point in the history
The memtrack_module variable was going out of scope and
function was exiting without freeing it. Free memtrack_module
if return nullptr.

Tests Done: Build and boot.

Tracked-On: OAM-122303
Signed-off-by: Tanuj Tekriwal <[email protected]>
  • Loading branch information
tanujtekriwal authored and sysopenci committed Sep 6, 2024
1 parent f47e59e commit be1c01d
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 7712038563e5463392f7805385f9fe4f3192a1e0 Mon Sep 17 00:00:00 2001
From: Tanuj Tekriwal <[email protected]>
Date: Thu, 5 Sep 2024 04:15:29 +0000
Subject: [PATCH] Fix for coverity issue for memtrack_module

The memtrack_module variable was going out of scope and
function was exiting without freeing it. Free memtrack_module
if return nullptr.

Tests Done: Build and boot.

Tracked-On: OAM-122303
Signed-off-by: Tanuj Tekriwal <[email protected]>
---
memtrack/aidl/default/Memtrack.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/memtrack/aidl/default/Memtrack.cpp b/memtrack/aidl/default/Memtrack.cpp
index dbf9a5cc92..8b4a58cf23 100644
--- a/memtrack/aidl/default/Memtrack.cpp
+++ b/memtrack/aidl/default/Memtrack.cpp
@@ -99,6 +99,7 @@ memtrack_module_t* AIDL_FETCH_IMemtrack(const char* /* name */) {
reinterpret_cast<hw_device_t**>(reinterpret_cast<memtrack_module_t**>(&memtrack_module)));
if (err) {
ALOGE("Passthrough failed to load legacy HAL.");
+ free(memtrack_module);
return nullptr;
}
}
--
2.34.1

0 comments on commit be1c01d

Please sign in to comment.