summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-04-05 12:47:50 -0700
committerMark Salyzyn <salyzyn@google.com>2017-04-05 13:02:08 -0700
commit191afba9bd17d7302a5bfb16d60ff12198336cc5 (patch)
tree054abcaa49b085da965a8a0ceca2eabdca5218e7 /liblog
parent568dc01fdf973c2d731c9dafe7c5b73ecb6627aa (diff)
downloadcore-191afba9bd17d7302a5bfb16d60ff12198336cc5.tar.gz
core-191afba9bd17d7302a5bfb16d60ff12198336cc5.tar.bz2
core-191afba9bd17d7302a5bfb16d60ff12198336cc5.zip
liblog: worry over resource leaks
Add comments so that future selves can clearly see there are no file descriptor resource leaks on normal return. SideEffects: None Test: Build Change-Id: Ieec504fea00fb849cdb69c669655a918d1334e61
Diffstat (limited to 'liblog')
-rw-r--r--liblog/event_tag_map.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/liblog/event_tag_map.cpp b/liblog/event_tag_map.cpp
index bdad2c2e6..0b977c21e 100644
--- a/liblog/event_tag_map.cpp
+++ b/liblog/event_tag_map.cpp
@@ -445,7 +445,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) {
mmap(NULL, end[which], which ? PROT_READ : PROT_READ | PROT_WRITE,
which ? MAP_SHARED : MAP_PRIVATE, fd[which], 0);
save_errno = errno;
- close(fd[which]);
+ close(fd[which]); /* fd DONE */
fd[which] = -1;
if ((newTagMap->mapAddr[which] != MAP_FAILED) &&
(newTagMap->mapAddr[which] != NULL)) {
@@ -465,6 +465,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) {
delete newTagMap;
return NULL;
}
+ /* See 'fd DONE' comments above and below, no need to clean up here */
}
return newTagMap;
@@ -473,7 +474,7 @@ fail_unmap:
save_errno = EINVAL;
delete newTagMap;
fail_close:
- for (which = 0; which < NUM_MAPS; ++which) close(fd[which]);
+ for (which = 0; which < NUM_MAPS; ++which) close(fd[which]); /* fd DONE */
fail_errno:
errno = save_errno;
return NULL;