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>
This commit is contained in:
Greg Hackmann 2014-04-06 21:25:58 -07:00
parent 223fc42b5e
commit 239605ef64
1 changed files with 1 additions and 1 deletions

View File

@ -401,7 +401,7 @@ void LogStatistics::format(char **buf,
const unsigned short spaces_total = 19;
if (*buf) {
free(buf);
free(*buf);
*buf = NULL;
}