[lttng-dev] [PATCH 1/2] Fix: initialize getline linesize argument to 0

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Oct 13 14:35:22 EDT 2015


It works by accident because getline() reallocates based on the initial
pointer, but doing this falls into a blind spot of the Linux man pages.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 converter/babeltrace-log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/converter/babeltrace-log.c b/converter/babeltrace-log.c
index c6f751e..5900b32 100644
--- a/converter/babeltrace-log.c
+++ b/converter/babeltrace-log.c
@@ -318,7 +318,7 @@ void trace_text(FILE *input, int output)
 	struct ctf_stream_pos pos;
 	ssize_t len;
 	char *line = NULL, *nl;
-	size_t linesize;
+	size_t linesize = 0;
 	int ret;
 
 	memset(&pos, 0, sizeof(pos));
-- 
2.1.4




More information about the lttng-dev mailing list