Skip to content

Commit

Permalink
Static Memory
Browse files Browse the repository at this point in the history
1. Change the static buffer for the echoserver and the memory
   descriptions to be static values.
2. Fixed a double-free on the memory statistics.
  • Loading branch information
ejohnstown committed Apr 26, 2024
1 parent 6a65f16 commit 559f24b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/echoserver/echoserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,10 @@ static int termios_show(int fd)
* and distList items and summing (32*64 + 128*118 + ...) and adding
* the sum of the distList values times the sizeof wc_Memory (rounded up
* to a word, 24). This total was 288kb plus change, rounded up to 289. */
const word32 static_sizeList[] =
static const word32 static_sizeList[] =
{32,128,384,800,3120,8400,17552,32846,131072};
const word32 static_distList[] = {64,118,3,4,6,2,2,2,1};
byte static_buffer[289*1024];
static const word32 static_distList[] = {64,118,3,4,6,2,2,2,1};
static byte static_buffer[289*1024];

static void wolfSSH_MemoryPrintStats(ES_HEAP_HINT* hint)
{
Expand Down
1 change: 1 addition & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ void SshResourceFree(WOLFSSH* ssh, void* heap)
if (hint->memory->flag & WOLFMEM_TRACK_STATS
&& hint->stats != NULL) {
WFREE(hint->stats, heap, DYNTYPE_SSH);
hint->stats = NULL;
}
}
#endif
Expand Down

0 comments on commit 559f24b

Please sign in to comment.