summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorTing-Yuan Huang <laszio@google.com>2017-02-07 15:53:32 -0800
committerTing-Yuan Huang <laszio@google.com>2017-02-07 15:53:32 -0800
commit106c3e6189203f73bc94a8c88cf41a0a1c22931f (patch)
tree6955a2730463a81012a98b897210a5eff8fdf006 /liblog
parent8eb237ad57a0a9b17b264d7528d9e01fe6b7e1d2 (diff)
downloadcore-106c3e6189203f73bc94a8c88cf41a0a1c22931f.tar.gz
core-106c3e6189203f73bc94a8c88cf41a0a1c22931f.tar.bz2
core-106c3e6189203f73bc94a8c88cf41a0a1c22931f.zip
liblog: fix a memory leak in __android_log_pmsg_file_write()
Free the strdup()-ed filename before returning error. Test: passed clang-tidy checks Bug: none Change-Id: I555492cb4e50400db758f7c721647a8747874a01
Diffstat (limited to 'liblog')
-rw-r--r--liblog/pmsg_writer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/liblog/pmsg_writer.c b/liblog/pmsg_writer.c
index c1c068e86..5e4ff98b3 100644
--- a/liblog/pmsg_writer.c
+++ b/liblog/pmsg_writer.c
@@ -285,6 +285,7 @@ LIBLOG_ABI_PRIVATE ssize_t __android_log_pmsg_file_write(
__android_log_unlock();
} else if (pmsgOpen() < 0) {
__android_log_unlock();
+ free(cp);
return -EBADF;
}
}