Skip to content

Commit

Permalink
Merge pull request #1 from HoboVR-Labs/lz-14
Browse files Browse the repository at this point in the history
src: receivers.h: Fixed memory leak
  • Loading branch information
Oleg Vorobiov authored Apr 15, 2022
2 parents 4cc0c09 + bd48fe5 commit bb3cd6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef __LAZY_SOCKETS_DEFS
#define __LAZY_SOCKETS_DEFS

#define __LAZY_SOCKETS_VERSION "0.2.3"
#define __LAZY_SOCKETS_BUILD 1644444000 // build date 2022 02 10
#define __LAZY_SOCKETS_VERSION "0.2.4"
#define __LAZY_SOCKETS_BUILD 1650062080 // build date 2022 02 10


// platform defined types
Expand Down
10 changes: 8 additions & 2 deletions src/receivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,20 @@ class ThreadedRecvLoop {

// check for a realloc call
if (m_realloc_buff){
recv_buff = (char*)realloc(recv_buff, m_buff_size + sizeof(m_tag));
char* temp = (char*)realloc(recv_buff, m_buff_size + sizeof(m_tag));
if (temp != recv_buff)
delete recv_buff;
recv_buff = temp;
m_realloc_buff = false;
}

// check for too small of a buffer
if (m_buff_size - recv_off <= 0) {
m_buff_size += recv_off;
recv_buff = (char*)realloc(recv_buff, m_buff_size + sizeof(m_tag));
char* temp = (char*)realloc(recv_buff, m_buff_size + sizeof(m_tag));
if (temp != recv_buff)
delete recv_buff;
recv_buff = temp;
}

// receive a partial message
Expand Down

0 comments on commit bb3cd6a

Please sign in to comment.