diff options
| author | Tom Cherry <tomcherry@google.com> | 2015-08-06 10:46:28 -0700 |
|---|---|---|
| committer | Tom Cherry <tomcherry@google.com> | 2015-08-10 14:26:03 -0700 |
| commit | 4ad60fbae51ef4a0b4a4beaa5128d823063c158c (patch) | |
| tree | d02822204807b956d60789711ca3e99938127b5f /trusty/coverage/coverage_test.cpp | |
| parent | 4bf3dc9345dcbadd79d26406c0c33e0c4a16ce29 (diff) | |
init: replace strdup() in parse_config()
Previously, the action, command, and service structs contained char*s
that referenced memory within the buffer returned by the strdup() of
the input buffer of parse_config. This prevented this entire memory
region from being freed, leaking contents that would never be referenced again.
The changes to convert the previous action, command, and service
structs to C++ classes created explicit ownership of the contents within
each class in the form of std::strings. With these changes, there are
no remaining references to the memory allocated by this strdup(), which
can now be freed.
This commit replaces the strdup() with std::vector<char> to allow for
the copied string to be freed when it goes out of scope instead of
relying on the C strdup() and free() functions.
Change-Id: Id0a5f711e33363082ba201afda6b26043998cb1c
Diffstat (limited to 'trusty/coverage/coverage_test.cpp')
0 files changed, 0 insertions, 0 deletions
