Skip to content

Commit

Permalink
Review comments 1
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Apr 10, 2019
1 parent e243605 commit cc0b378
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ void resolveClients(bool onlynew)
lock_shm();

// Only store new hostname if it changed
// We do not need to check for name == NULL as name is
// always initialized with an empty string at position 0
if(hostname != NULL && strcmp(name, hostname) != 0)
{
// We do not need to check for name == NULL as name is
// always initialized with an empty string at position 0
clients[clientID].namepos = addstr(hostname);
}
else if(config.debug & DEBUG_SHMEM)
Expand All @@ -112,7 +112,8 @@ void resolveClients(bool onlynew)
}

// Release allocated memory
free(hostname);
if(hostname != NULL)
free(hostname);

// Mark entry as not new
clients[clientID].new = false;
Expand Down Expand Up @@ -150,10 +151,10 @@ void resolveForwardDestinations(bool onlynew)
// Finally, lock data when storing obtained hostname
lock_shm();
// Only store new hostname if it changed
// We do not need to check for name == NULL as name is
// always initialized with an empty string at position 0
if(hostname != NULL && strcmp(name, hostname) != 0)
{
// We do not need to check for name == NULL as name is
// always initialized with an empty string at position 0
forwarded[forwardID].namepos = addstr(hostname);
}
else if(config.debug & DEBUG_SHMEM)
Expand All @@ -163,7 +164,8 @@ void resolveForwardDestinations(bool onlynew)
}

// Release allocated memory
free(hostname);
if(hostname != NULL)
free(hostname);

// Mark entry as not new
forwarded[forwardID].new = false;
Expand Down

0 comments on commit cc0b378

Please sign in to comment.