[lttng-tools] Fix: null pointer dereference
Commit Message
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
src/lib/lttng-ctl/rotate.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
Merged in master, thanks!
Jérémie
On Tue, Apr 10, 2018 at 04:33:32PM -0400, Jonathan Rajotte wrote:
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/lib/lttng-ctl/rotate.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.c
> index bdce8d8..e340429 100644
> --- a/src/lib/lttng-ctl/rotate.c
> +++ b/src/lib/lttng-ctl/rotate.c
> @@ -268,8 +268,11 @@ end:
> void lttng_rotation_handle_destroy(
> struct lttng_rotation_handle *rotation_handle)
> {
> - lttng_trace_archive_location_destroy(rotation_handle->archive_location);
> - free(rotation_handle);
> + if (rotation_handle) {
> + lttng_trace_archive_location_destroy(rotation_handle->archive_location);
> + free(rotation_handle);
> + rotation_handle = NULL;
> + }
> }
>
> static
> --
> 2.7.4
>
@@ -268,8 +268,11 @@ end:
void lttng_rotation_handle_destroy(
struct lttng_rotation_handle *rotation_handle)
{
- lttng_trace_archive_location_destroy(rotation_handle->archive_location);
- free(rotation_handle);
+ if (rotation_handle) {
+ lttng_trace_archive_location_destroy(rotation_handle->archive_location);
+ free(rotation_handle);
+ rotation_handle = NULL;
+ }
}
static