summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2014-04-06 21:25:58 -0700
committerGreg Hackmann <ghackmann@google.com>2014-04-07 15:17:30 -0700
commit239605ef64d34ced82c97870e3f3f5c4145be58c (patch)
tree0e3b255dab39309d8351535b3ae94e9c66c9c874
parent223fc42b5e289e882f67c893374ffbef595a6901 (diff)
downloadsystem_core-239605ef64d34ced82c97870e3f3f5c4145be58c.zip
system_core-239605ef64d34ced82c97870e3f3f5c4145be58c.tar.gz
system_core-239605ef64d34ced82c97870e3f3f5c4145be58c.tar.bz2
logd: fix LogStatistics::format freeing wrong pointer
Fixes a leak and use-after-free if a client passes in an already-allocated target buffer (currently none do) Change-Id: Ie20c30bd5ba31e1b6db73885bd9d2ebd7e40dc27 Signed-off-by: Greg Hackmann <ghackmann@google.com>
-rw-r--r--logd/LogStatistics.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 5622ee5..88414d9 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -401,7 +401,7 @@ void LogStatistics::format(char **buf,
const unsigned short spaces_total = 19;
if (*buf) {
- free(buf);
+ free(*buf);
*buf = NULL;
}