Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: receivers.h: Fixed memory leak #1

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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