[PATCH v3 0/6] tr2: plug memory leaks + logic errors + Win32 & Linux feature parity
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-08-27 08:03:59
A hopefully final re-roll with minor commit message changes. Thanks
everyone for the reviews!
Ævar Arnfjörð Bjarmason (6):
tr2: remove NEEDSWORK comment for "non-procfs" implementations
tr2: clarify TRACE2_PROCESS_INFO_EXIT comment under Linux
tr2: stop leaking "thread_name" memory
tr2: leave the parent list empty upon failure & don't leak memory
tr2: do compiler enum check in trace2_collect_process_info()
tr2: log N parent process names on Linux
compat/linux/procinfo.c | 169 ++++++++++++++++++++++++++++++++++------
trace2/tr2_tls.c | 1 +
2 files changed, 146 insertions(+), 24 deletions(-)
Range-diff against v2:
1: 8c649ce3b4 = 1: 306f14a0f7 tr2: remove NEEDSWORK comment for "non-procfs" implementations
2: 0150e3402a = 2: a999e016a9 tr2: clarify TRACE2_PROCESS_INFO_EXIT comment under Linux
3: 1d835d6767 = 3: 45769da953 tr2: stop leaking "thread_name" memory
4: 1aa0dbc394 ! 4: 946140691f tr2: fix memory leak & logic error in 2f732bf15e6
@@ Metadata
Author: Ævar Arnfjörð Bjarmason [off-list ref]
## Commit message ##
- tr2: fix memory leak & logic error in 2f732bf15e6
+ tr2: leave the parent list empty upon failure & don't leak memory
In a subsequent commit I'll be replacing most of this code to log N
parents, but let's first fix bugs introduced in the recent
@@ Commit message
system where we could read the file from procfs.
Let's move all the freeing of the memory to the end of the
- function. If we're still at STRBUF_INIT with "name" due to not haven
+ function. If we're still at STRBUF_INIT with "name" due to not having
taken the branch where the strbuf_read_file() succeeds freeing it is
- redundant, so we could move it into the body of the "if", but just
+ redundant. So we could move it into the body of the "if", but just
handling freeing the same way for all branches of the function makes
it more readable.
5: 70fef093d8 = 5: 0bea5aa9c9 tr2: do compiler enum check in trace2_collect_process_info()
6: f6aac90248 = 6: 6eac9986c3 tr2: log N parent process names on Linux
--
2.33.0.736.g68690aaec9a