From 1e061ff1e3fcfcd020df1a35c1c0697c114cb209 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 18 Dec 2018 11:33:30 +1100 Subject: ctdb-tool: Avoid data uninitialized warnings ../../tools/ctdb.c: In function 'str_to_data': ../../tools/ctdb.c:624: warning: 'data.dsize' may be used uninitialized in this function ../../tools/ctdb.c:624: warning: 'data.dptr' may be used uninitialized in this function Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/tools/ctdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ctdb/tools') diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index b598a866c9b..eb4c684e8b0 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -626,6 +626,9 @@ static int str_to_data(const char *str, size_t len, TALLOC_CTX *mem_ctx, if (strncmp(str, "0x", 2) == 0) { ret = hex_to_data(str+2, len-2, mem_ctx, &data); + if (ret != 0) { + return ret; + } } else { data.dptr = talloc_memdup(mem_ctx, str, len); if (data.dptr == NULL) { @@ -635,7 +638,7 @@ static int str_to_data(const char *str, size_t len, TALLOC_CTX *mem_ctx, } *out = data; - return ret; + return 0; } static int run_helper(TALLOC_CTX *mem_ctx, const char *command, -- cgit v1.2.1