system/corennnnn
Revision | 6866f143bf855d796887b2f8ee8752f09a7516d6 (tree) |
---|---|
Time | 2016-09-30 07:51:44 |
Author | Linux Build Service Account <lnxbuild@loca...> |
Commiter | Gerrit - the friendly Code Review server |
Merge "Fix a memory leak in logcat binary"
@@ -169,10 +169,17 @@ static void writeEntryToLogDump(AndroidLogEntry *entry) | ||
169 | 169 | { |
170 | 170 | int bytesWrittenToLogDump = 0; |
171 | 171 | char defaultBuffer[512]; |
172 | + char *outBuffer = NULL; | |
172 | 173 | size_t logLength; |
173 | 174 | |
174 | 175 | // Get logLength |
175 | - android_log_formatLogLine(g_logformat, defaultBuffer,sizeof(defaultBuffer), entry, &logLength); | |
176 | + outBuffer = android_log_formatLogLine(g_logformat, defaultBuffer, | |
177 | + sizeof(defaultBuffer), | |
178 | + entry, | |
179 | + &logLength); | |
180 | + if (outBuffer != defaultBuffer) { | |
181 | + free(outBuffer); | |
182 | + } | |
176 | 183 | |
177 | 184 | // Check if the to-be-inserted log exceeds the available buffer size; And rotate if needed. |
178 | 185 | checkAndRotateLogDump(logLength); |