From 3a698651d74e5178db381912bf31eea673a54224 Mon Sep 17 00:00:00 2001 From: "hta@webrtc.org" Date: Wed, 16 May 2012 14:28:52 +0000 Subject: [PATCH] Coverity issue 14317 (uninitialized status may influence execution flow) Solution: restructure the flow when AquireSocket fails BUG=coverity:14317 TEST=trybot Review URL: https://webrtc-codereview.appspot.com/573006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2252 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../udp_transport/source/udp_socket2_windows.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/modules/udp_transport/source/udp_socket2_windows.cc b/src/modules/udp_transport/source/udp_socket2_windows.cc index 1c442c5036..2362cdd011 100644 --- a/src/modules/udp_transport/source/udp_socket2_windows.cc +++ b/src/modules/udp_transport/source/udp_socket2_windows.cc @@ -730,7 +730,6 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, } QOS Qos; - WebRtc_Word32 result ; DWORD BytesRet; QOS_DESTADDR QosDestaddr; @@ -802,14 +801,14 @@ bool UdpSocket2Windows::SetQos(WebRtc_Word32 serviceType, Qos.ProviderSpecific.buf = (char*)&QosDestaddr; } - if(AquireSocket()) - { - // To set QoS with SIO_SET_QOS the socket must be locally bound first - // or the call will fail with error code 10022. - result = WSAIoctl(GetFd(), SIO_SET_QOS, &Qos, sizeof(QOS), NULL, 0, - &BytesRet, NULL,NULL); - ReleaseSocket(); + if(!AquireSocket()) { + return false; } + // To set QoS with SIO_SET_QOS the socket must be locally bound first + // or the call will fail with error code 10022. + WebRtc_Word32 result = WSAIoctl(GetFd(), SIO_SET_QOS, &Qos, sizeof(QOS), + NULL, 0, &BytesRet, NULL,NULL); + ReleaseSocket(); if (result == SOCKET_ERROR) { WEBRTC_TRACE(kTraceError, kTraceTransport, _id,