From 239605ef64d34ced82c97870e3f3f5c4145be58c Mon Sep 17 00:00:00 2001 From: Greg Hackmann Date: Sun, 6 Apr 2014 21:25:58 -0700 Subject: [PATCH] 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 --- logd/LogStatistics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp index 5622ee5b1..88414d970 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; }