Skip to content

Commit

Permalink
Merge pull request #402 from SlideRuleEarth/clustersoc-memleak
Browse files Browse the repository at this point in the history
fixed memory leak in clustersocket
  • Loading branch information
jpswinski authored May 16, 2024
2 parents 6c928da + 5c29650 commit dca5431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/ClusterSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ ClusterSocket::~ClusterSocket(void)
SockLib::sockclose(fd);
fd = write_connections.next( &writeCon );
}

/* Table desctructor will free connections memory */
}

/*----------------------------------------------------------------------------
Expand Down Expand Up @@ -193,7 +195,7 @@ int ClusterSocket::writeBuffer(const void *buf, int len, int timeout)
{
return TIMEOUT_RC;
}

if(len <= MAX_MSG_SIZE)
{
int status = pubsockq->postCopy(buf, len, timeout);
Expand Down
5 changes: 4 additions & 1 deletion packages/core/Table.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ Table<T,K>::Table(K table_size, hash_func_t _hash)
template <class T, typename K>
Table<T,K>::~Table(void)
{
/* Free All Nodes */
clear();

/* Free Hash Structure */
delete [] table;
}
Expand Down Expand Up @@ -304,7 +307,7 @@ T& Table<T,K>::get(K key, match_t match, bool resort)
best_index = curr_index;
break;
}

if(match == MATCH_NEAREST_UNDER)
{
if(table[curr_index].key < key)
Expand Down

0 comments on commit dca5431

Please sign in to comment.