OSDN Git Service

Fix memory leak in RenderThread::dumpGraphicsMemory.
authorJosh Gao <jmgao@google.com>
Tue, 26 Jun 2018 18:41:34 +0000 (11:41 -0700)
committerJosh Gao <jmgao@google.com>
Tue, 26 Jun 2018 19:37:42 +0000 (12:37 -0700)
This would have been a double-close of fd, except we just leak the
FILE* instead.

Test: treehugger
Change-Id: I519366fbcf0eb6f03f79c22abfa2b1b1b493a70a

libs/hwui/renderthread/RenderThread.cpp

index 72a428f..bd34eb8 100644 (file)
@@ -236,10 +236,8 @@ void RenderThread::dumpGraphicsMemory(int fd) {
             break;
     }
 
-    FILE *file = fdopen(fd, "a");
-    fprintf(file, "\n%s\n", cachesOutput.string());
-    fprintf(file, "\nPipeline=%s\n", pipeline.string());
-    fflush(file);
+    dprintf(fd, "\n%s\n", cachesOutput.string());
+    dprintf(fd, "\nPipeline=%s\n", pipeline.string());
 }
 
 Readback& RenderThread::readback() {