From: OpenOCD-Gerrit <ope...@us...> - 2022-06-08 08:46:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 822097a351f8aef0036359bc3f4ad3972c1ddbe3 (commit) from 4f42600541d2f96a3a134699091e12179c82401a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 822097a351f8aef0036359bc3f4ad3972c1ddbe3 Author: Erhan Kurubas <erh...@es...> Date: Sat May 28 22:31:34 2022 +0200 telnet_server: fix valgrind error Error: Uninitialised value was created by a heap allocation at telnet_new_connection (telnet_server.c:227) Signed-off-by: Erhan Kurubas <erh...@es...> Change-Id: I698a3648be698c93a2395a718ee1ade028226995 Reviewed-on: https://review.openocd.org/c/openocd/+/7006 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 791a1a548..4fc71f384 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -222,9 +222,8 @@ static int telnet_new_connection(struct connection *connection) { struct telnet_connection *telnet_connection; struct telnet_service *telnet_service = connection->service->priv; - int i; - telnet_connection = malloc(sizeof(struct telnet_connection)); + telnet_connection = calloc(1, sizeof(struct telnet_connection)); if (!telnet_connection) { LOG_ERROR("Failed to allocate telnet connection."); @@ -234,9 +233,6 @@ static int telnet_new_connection(struct connection *connection) connection->priv = telnet_connection; /* initialize telnet connection information */ - telnet_connection->closed = false; - telnet_connection->line_size = 0; - telnet_connection->line_cursor = 0; telnet_connection->prompt = strdup("> "); telnet_connection->prompt_visible = true; telnet_connection->state = TELNET_STATE_DATA; @@ -257,11 +253,6 @@ static int telnet_new_connection(struct connection *connection) telnet_write(connection, "\r", 1); telnet_prompt(connection); - /* initialize history */ - for (i = 0; i < TELNET_LINE_HISTORY_SIZE; i++) - telnet_connection->history[i] = NULL; - telnet_connection->next_history = 0; - telnet_connection->current_history = 0; telnet_load_history(telnet_connection); log_add_callback(telnet_log_callback, connection); ----------------------------------------------------------------------- Summary of changes: src/server/telnet_server.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) hooks/post-receive -- Main OpenOCD repository |