mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
There is no reason to allocate space for a constant string. Remove this.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -426,7 +426,7 @@ void getTopClients(char *client_message, int *sock)
|
||||
|
||||
void getForwardDestinations(char *client_message, int *sock)
|
||||
{
|
||||
bool allocated = false, sort = true;
|
||||
bool sort = true;
|
||||
int i, temparray[counters.forwarded+1][2], forwardedsum = 0, totalqueries = 0;
|
||||
|
||||
if(command(client_message, "unsorted"))
|
||||
@@ -473,14 +473,12 @@ void getForwardDestinations(char *client_message, int *sock)
|
||||
// Is this the "local" forward destination?
|
||||
if(j == counters.forwarded)
|
||||
{
|
||||
ip = strdup("local");
|
||||
ip = "local";
|
||||
name = ip;
|
||||
|
||||
if(totalqueries > 0)
|
||||
// Whats the percentage of (cached + blocked) queries on the total amount of queries?
|
||||
percentage = 1e2f * (counters.cached + counters.blocked) / totalqueries;
|
||||
|
||||
allocated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -511,8 +509,6 @@ void getForwardDestinations(char *client_message, int *sock)
|
||||
// we simply have to scale b by a which is what we do in the following.
|
||||
if(forwardedsum > 0 && totalqueries > 0)
|
||||
percentage = 1e2f * forwarded[j].count / forwardedsum * counters.forwardedqueries / totalqueries;
|
||||
|
||||
allocated = false;
|
||||
}
|
||||
|
||||
// Send data if count > 0
|
||||
@@ -528,13 +524,6 @@ void getForwardDestinations(char *client_message, int *sock)
|
||||
pack_float(*sock, (float) percentage);
|
||||
}
|
||||
}
|
||||
|
||||
// Free previously allocated memory only if we allocated it
|
||||
if(allocated)
|
||||
{
|
||||
free(ip);
|
||||
//free(name); // This is just the same as ip
|
||||
}
|
||||
}
|
||||
|
||||
if(debugclients)
|
||||
|
||||
Reference in New Issue
Block a user