From ee040835254bea84cb1f1f9e215e8498677dace0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 20 Jun 2011 15:39:36 +0200 Subject: [PATCH 1/2] s3-rpc_client: Fix some valgrind warnings. These are in/out values and need to be initialized. --- source3/rpc_client/cli_winreg.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source3/rpc_client/cli_winreg.c b/source3/rpc_client/cli_winreg.c index 3731fc7..e5ebc25 100644 --- a/source3/rpc_client/cli_winreg.c +++ b/source3/rpc_client/cli_winreg.c @@ -33,7 +33,7 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx, WERROR *pwerr) { struct winreg_String wvalue; - enum winreg_Type type; + enum winreg_Type type = REG_NONE; uint32_t value_len = 0; uint32_t data_size = 0; WERROR result = WERR_OK; @@ -69,7 +69,7 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx, return status; } - blob = data_blob_talloc(mem_ctx, NULL, data_size); + blob = data_blob_talloc_zero(mem_ctx, data_size); if (blob.data == NULL) { *pwerr = WERR_NOMEM; return status; @@ -108,13 +108,14 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx, WERROR *pwerr) { struct winreg_String wvalue; - enum winreg_Type type; + enum winreg_Type type = REG_NONE; WERROR result = WERR_OK; uint32_t value_len = 0; uint32_t data_size = 0; NTSTATUS status; DATA_BLOB blob; + ZERO_STRUCT(wvalue); wvalue.name = value; status = dcerpc_winreg_QueryValue(h, @@ -139,7 +140,7 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx, return status; } - blob = data_blob_talloc(mem_ctx, NULL, data_size); + blob = data_blob_talloc_zero(mem_ctx, data_size); if (blob.data == NULL) { *pwerr = WERR_NOMEM; return status; @@ -179,7 +180,7 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx, WERROR *pwerr) { struct winreg_String wvalue; - enum winreg_Type type; + enum winreg_Type type = REG_NONE; WERROR result = WERR_OK; uint32_t value_len = 0; uint32_t data_size = 0; @@ -210,7 +211,7 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx, return status; } - blob = data_blob_talloc(mem_ctx, NULL, data_size); + blob = data_blob_talloc_zero(mem_ctx, data_size); if (blob.data == NULL) { *pwerr = WERR_NOMEM; return status; @@ -254,7 +255,7 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx, WERROR *pwerr) { struct winreg_String wvalue; - enum winreg_Type type; + enum winreg_Type type = REG_NONE; WERROR result = WERR_OK; uint32_t value_len = 0; uint32_t data_size = 0; @@ -285,7 +286,7 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx, return status; } - blob = data_blob_talloc(mem_ctx, NULL, data_size); + blob = data_blob_talloc_zero(mem_ctx, data_size); if (blob.data == NULL) { *pwerr = WERR_NOMEM; return status; @@ -380,13 +381,14 @@ NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx, uint32_t data, WERROR *pwerr) { - struct winreg_String wvalue = { 0, }; + struct winreg_String wvalue; DATA_BLOB blob; WERROR result = WERR_OK; NTSTATUS status; + ZERO_STRUCT(wvalue); wvalue.name = value; - blob = data_blob_talloc(mem_ctx, NULL, 4); + blob = data_blob_talloc_zero(mem_ctx, 4); SIVAL(blob.data, 0, data); status = dcerpc_winreg_SetValue(h, -- 1.7.5.4 From 1e9ec4a9c0937ca33052a91a95bf2ca3e6137439 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 20 Jun 2011 19:27:01 +0200 Subject: [PATCH 2/2] s3-spoolss: Fix some valgrind warnings. These are in/out values and need to be initialized. --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 6 +++--- source3/rpc_server/spoolss/srv_spoolss_util.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index cb311ef..8216388 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -9191,9 +9191,9 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p, int snum = 0; WERROR result = WERR_OK; DATA_BLOB blob; - enum winreg_Type val_type; - uint8_t *val_data; - uint32_t val_size; + enum winreg_Type val_type = REG_NONE; + uint8_t *val_data = NULL; + uint32_t val_size = 0; DEBUG(4,("_spoolss_GetPrinterDataEx\n")); diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index ecb3567..5201571 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -471,7 +471,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx, data_size = max_valbufsize; data = NULL; if (data_size) { - data = (uint8_t *) TALLOC(tmp_ctx, data_size); + data = (uint8_t *) talloc_zero_size(tmp_ctx, data_size); } length = 0; @@ -2315,9 +2315,9 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx, struct dcerpc_binding_handle *winreg_handle = NULL; struct policy_handle hive_hnd, key_hnd; struct winreg_String wvalue; - enum winreg_Type type_in; + enum winreg_Type type_in = REG_NONE; char *path; - uint8_t *data_in; + uint8_t *data_in = NULL; uint32_t data_in_size = 0; uint32_t value_len = 0; WERROR result = WERR_OK; @@ -3337,8 +3337,8 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx, struct dcerpc_binding_handle *winreg_handle = NULL; struct policy_handle hive_hnd, key_hnd; struct winreg_String wvalue; - enum winreg_Type type_in; - uint8_t *data_in; + enum winreg_Type type_in = REG_NONE; + uint8_t *data_in = NULL; uint32_t data_in_size = 0; uint32_t value_len = 0; uint32_t num_builtin = ARRAY_SIZE(builtin_forms1); -- 1.7.5.4