From e8bb79be2d924e4fa0d74c76b341e08d44944e01 Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Tue, 21 Aug 2018 20:51:13 +0700 Subject: [PATCH] do not init and copy to ctr_dest_addr unless have data --- src/core/hle/service/soc_u.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index df53c5c2a..a0177d4fa 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -544,11 +544,10 @@ void SOC_U::SendTo(Kernel::HLERequestContext& ctx) { auto input_buff = rp.PopStaticBuffer(); auto dest_addr_buff = rp.PopStaticBuffer(); - CTRSockAddr ctr_dest_addr; - std::memcpy(&ctr_dest_addr, dest_addr_buff.data(), sizeof(ctr_dest_addr)); - s32 ret = -1; if (addr_len > 0) { + CTRSockAddr ctr_dest_addr; + std::memcpy(&ctr_dest_addr, dest_addr_buff.data(), sizeof(ctr_dest_addr)); sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr); ret = ::sendto(socket_handle, reinterpret_cast(input_buff.data()), len, flags, &dest_addr, sizeof(dest_addr));