Fix: lttng: poptGetArg doesn't provide string ownership
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 31 Oct 2022 19:52:46 +0000 (15:52 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 8 Dec 2022 14:47:12 +0000 (09:47 -0500)
commit5b915816f16e7cb3134dd7279abad79b31c2486c
treed8beaa1a0076568082faaa84b7dcd5a39121bd47
parent3957512ed31ca945f8353d5812f317314c905640
Fix: lttng: poptGetArg doesn't provide string ownership

The string returned by poptGetArg() is 'const' because it is owned by
the popt librairy and is free'd by it when poptFreeContext() is called.
Copy those strings when we need to alter them to maintain proper
ownership.

The latest release of popt (v1.19) introduced a breaking
change (changing the ownership of left-over command line arguments) that
can cause double free()-s.

This is ultimately due to this upstream commit in popt 1.19:
https://github.com/rpm-software-management/popt/commit/7182e4618ad5a0186145fc2aa4a98c2229afdfa8

which is derived from a package patch:
https://src.fedoraproject.org/rpms/babeltrace/c/d48452beff87b145c038f070e7182358db04336c?branch=rawhide

Change-Id: Id2535d1534c0e47cc0747968d6dd60a587f0b810
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
15 files changed:
src/bin/lttng/commands/clear.cpp
src/bin/lttng/commands/create.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/disable_channels.cpp
src/bin/lttng/commands/disable_events.cpp
src/bin/lttng/commands/enable_channels.cpp
src/bin/lttng/commands/enable_events.cpp
src/bin/lttng/commands/help.cpp
src/bin/lttng/commands/list.cpp
src/bin/lttng/commands/rotate.cpp
src/bin/lttng/commands/save.cpp
src/bin/lttng/commands/set_session.cpp
src/bin/lttng/commands/start.cpp
src/bin/lttng/commands/stop.cpp
src/bin/lttng/commands/view.cpp
This page took 0.028061 seconds and 4 git commands to generate.