logd: LogStatistics leak
- uid = -1 in subtract operation to match add
(cherry pick from commit f48ea7c8dcfbf2220ececccb1f4fb2f42df9048c)
Bug: 15986335
Change-Id: I7d0b85b5334c5264fd04309cb78e0c9aec0ad261
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 42ac287..792044c 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -302,6 +302,10 @@
}
void LidStatistics::subtract(unsigned short size, uid_t uid, pid_t pid) {
+ if (uid == (uid_t) -1) { // init
+ uid = (uid_t) AID_ROOT;
+ }
+
UidStatisticsCollection::iterator it;
for (it = begin(); it != end(); ++it) {
UidStatistics *u = *it;