aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael West <michael.west@ettus.com>2013-10-23 15:42:37 -0700
committerMichael West <michael.west@ettus.com>2013-10-23 15:42:37 -0700
commita2e4b7a88e141366a317a631ffe0a26bb0f8f375 (patch)
treee28c56f0ab16051c0ea3c7ad770679c5004bb088
parent2ebb45abf033b7ecdced07d17f536fc1308a4506 (diff)
downloaduhd-a2e4b7a88e141366a317a631ffe0a26bb0f8f375.tar.gz
uhd-a2e4b7a88e141366a317a631ffe0a26bb0f8f375.tar.bz2
uhd-a2e4b7a88e141366a317a631ffe0a26bb0f8f375.zip
CID 1104337: Fixed improper use of negative value
CID 1104314: Fixed uninitialized scalar
-rw-r--r--host/lib/transport/udp_zero_copy.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp
index 166177177..7b6a476f5 100644
--- a/host/lib/transport/udp_zero_copy.cpp
+++ b/host/lib/transport/udp_zero_copy.cpp
@@ -68,7 +68,7 @@ static void check_registry_for_fast_send_threshold(const size_t mtu){
class udp_zero_copy_asio_mrb : public managed_recv_buffer{
public:
udp_zero_copy_asio_mrb(void *mem, int sock_fd, const size_t frame_size):
- _mem(mem), _sock_fd(sock_fd), _frame_size(frame_size) { /*NOP*/ }
+ _mem(mem), _sock_fd(sock_fd), _frame_size(frame_size), _len(0) { /*NOP*/ }
void release(void){
_claimer.release();
@@ -87,6 +87,7 @@ public:
if (wait_for_recv_ready(_sock_fd, timeout)){
_len = ::recv(_sock_fd, (char *)_mem, _frame_size, 0);
+ UHD_ASSERT_THROW(_len > 0); // TODO: Handle case of recv error
index++; //advances the caller's buffer
return make(this, _mem, size_t(_len));
}