From: Volker Lendecke Date: Fri, 23 Jul 2021 06:46:51 +0000 (+0200) Subject: lib;smbd: Fix the -Os build by initializing variables X-Git-Tag: ldb-2.5.0~1017 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=621f561a9c2c3fa905211643ae18cceb92ca5dea;p=thirdparty%2Fsamba.git lib;smbd: Fix the -Os build by initializing variables Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/lib/mscat/mscat_ctl.c b/lib/mscat/mscat_ctl.c index 974ace83c30..426ddc57161 100644 --- a/lib/mscat/mscat_ctl.c +++ b/lib/mscat/mscat_ctl.c @@ -990,8 +990,8 @@ static int ctl_get_member_attributes(struct mscat_ctl *ctl, ok = mscat_asn1_oid_equal(oid, CAT_MEMBERINFO_OBJID); if (ok) { - char *name; - uint32_t id; + char *name = NULL; + uint32_t id = 0; rc = ctl_parse_member_info(ctl, tmp_ctx, diff --git a/source3/lib/sendfile.c b/source3/lib/sendfile.c index d3effaf30aa..69c89d29f31 100644 --- a/source3/lib/sendfile.c +++ b/source3/lib/sendfile.c @@ -136,12 +136,9 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset out: if (socket_flags_changed) { - int saved_errno; + int saved_errno = errno; int err; - if (ret == -1) { - saved_errno = errno; - } /* Restore the old state of the socket. */ err = fcntl(tofd, F_SETFL, old_flags); if (err == -1) { diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c index 8270771c79b..ca46ae53012 100644 --- a/source3/rpc_client/cli_winreg_spoolss.c +++ b/source3/rpc_client/cli_winreg_spoolss.c @@ -3699,11 +3699,11 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx, { uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; struct policy_handle hive_hnd, key_hnd; - struct spoolss_DriverInfo8 i8, *info8; + struct spoolss_DriverInfo8 i8, *info8 = NULL; struct spoolss_PrinterEnumValues *enum_values = NULL; - struct spoolss_PrinterEnumValues *v; + struct spoolss_PrinterEnumValues *v = NULL; uint32_t num_values = 0; - TALLOC_CTX *tmp_ctx; + TALLOC_CTX *tmp_ctx = NULL; WERROR result; NTSTATUS status; uint32_t i; @@ -4168,15 +4168,15 @@ WERROR winreg_get_core_driver(TALLOC_CTX *mem_ctx, { uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; struct policy_handle hive_hnd, key_hnd; - struct spoolss_CorePrinterDriver *c; + struct spoolss_CorePrinterDriver *c = NULL; struct spoolss_PrinterEnumValues *enum_values = NULL; - struct spoolss_PrinterEnumValues *v; + struct spoolss_PrinterEnumValues *v = NULL; uint32_t num_values = 0; - TALLOC_CTX *tmp_ctx; + TALLOC_CTX *tmp_ctx = NULL; WERROR result; NTSTATUS status; - const char *path; - const char *guid_str; + const char *path = NULL; + const char *guid_str = NULL; uint32_t i; const char **enum_names = NULL; enum winreg_Type *enum_types = NULL; @@ -4505,12 +4505,12 @@ WERROR winreg_get_driver_package(TALLOC_CTX *mem_ctx, uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; struct policy_handle hive_hnd, key_hnd; struct spoolss_PrinterEnumValues *enum_values = NULL; - struct spoolss_PrinterEnumValues *v; + struct spoolss_PrinterEnumValues *v = NULL; uint32_t num_values = 0; - TALLOC_CTX *tmp_ctx; + TALLOC_CTX *tmp_ctx = NULL; WERROR result; NTSTATUS status; - const char *path; + const char *path = NULL; uint32_t i; const char **enum_names = NULL; enum winreg_Type *enum_types = NULL; diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c index 7d925d6c3b7..475c8e9f508 100644 --- a/source3/smbd/notifyd/notifyd.c +++ b/source3/smbd/notifyd/notifyd.c @@ -336,11 +336,11 @@ static bool notifyd_apply_rec_change( struct sys_notify_context *sys_notify_ctx, struct messaging_context *msg_ctx) { - struct db_record *rec; - struct notifyd_instance *instances; + struct db_record *rec = NULL; + struct notifyd_instance *instances = NULL; size_t num_instances; size_t i; - struct notifyd_instance *instance; + struct notifyd_instance *instance = NULL; TDB_DATA value; NTSTATUS status; bool ok = false; diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c index a1571aad46b..4910c57c322 100644 --- a/source3/smbd/oplock_linux.c +++ b/source3/smbd/oplock_linux.c @@ -51,7 +51,7 @@ int linux_set_lease_sighandler(int fd) int linux_setlease(int fd, int leasetype) { int ret; - int saved_errno; + int saved_errno = 0; /* * Ensure the lease owner is root to allow diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c index eed70718021..3bd0f59044f 100644 --- a/source4/torture/smb2/dir.c +++ b/source4/torture/smb2/dir.c @@ -116,7 +116,7 @@ static bool test_find(struct torture_context *tctx, NTSTATUS status; bool ret = true; unsigned int count; - int i, j, file_count = 0; + int i, j = 0, file_count = 0; status = populate_tree(tctx, mem_ctx, tree, files, NFILES, &h); @@ -1300,7 +1300,7 @@ static bool test_large_files(struct torture_context *tctx, struct smb2_find f; struct smb2_handle h = {{0}}; union smb_search_data *d; - int i, j, file_count = 0; + int i, j = 0, file_count = 0; char **strs = NULL; unsigned count;