diff mbox series

[lttng-tools] Fix: null pointer dereference

Message ID 1523392412-1379-1-git-send-email-jonathan.rajotte-julien@efficios.com
State Accepted, archived
Delegated to: Jérémie Galarneau
Headers show
Series [lttng-tools] Fix: null pointer dereference | expand

Commit Message

Jonathan Rajotte April 10, 2018, 8:33 p.m. UTC
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

Jérémie Galarneau April 10, 2018, 10:42 p.m. UTC | #1
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
>
diff mbox series

Patch

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