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:
parent
223fc42b5e
commit
239605ef64
|
@ -401,7 +401,7 @@ void LogStatistics::format(char **buf,
|
|||
const unsigned short spaces_total = 19;
|
||||
|
||||
if (*buf) {
|
||||
free(buf);
|
||||
free(*buf);
|
||||
*buf = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue