[lttng-dev] [PATCH lttng-tools] Fix: null pointer dereference

Jonathan Rajotte jonathan.rajotte-julien at efficios.com
Tue Apr 10 16:33:32 EDT 2018


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



More information about the lttng-dev mailing list