comment malloc lines out

This commit is contained in:
PolynomialDivision 2017-09-07 20:14:35 +02:00
parent c834261203
commit 32c5de1a5d
6 changed files with 19 additions and 17 deletions

View file

@ -97,13 +97,13 @@ char *gcrypt_decrypt_msg(char *msg, size_t msg_length) {
printf("gcry_cipher_encrypt failed: %s/%s\n",
gcry_strsource(gcry_error_handle),
gcry_strerror(gcry_error_handle));
printf("Free %s: %p\n","out_buffer", out_buffer);
//printf("Free %s: %p\n","out_buffer", out_buffer);
free(out_buffer);
return NULL;
}
char *out = malloc(strlen(out_buffer) + 1);
strcpy(out, out_buffer);
printf("Free %s: %p\n","out_buffer", out_buffer);
//printf("Free %s: %p\n","out_buffer", out_buffer);
free(out_buffer);
return out;
}

View file

@ -80,6 +80,7 @@ typedef struct ap_s {
uint32_t freq;
uint8_t ht;
uint8_t vht;
uint8_t channel_utilization;
time_t time;
} ap;

View file

@ -25,8 +25,8 @@
#include <stdio.h>
#include <dlfcn.h>
static void* (*real_malloc)(size_t)=NULL;
static void* (*real_free)(void *p)=NULL;
//static void* (*real_malloc)(size_t)=NULL;
//static void* (*real_free)(void *p)=NULL;
void daemon_shutdown();
@ -34,7 +34,7 @@ void signal_handler(int sig);
struct sigaction newSigAction;
int free_counter = 0;
//int free_counter = 0;
pthread_t tid_probe;
pthread_t tid_client;
@ -59,7 +59,7 @@ void daemon_shutdown()
pthread_mutex_destroy(&client_array_mutex);
pthread_mutex_destroy(&ap_array_mutex);
printf("Free Counter: %d\n", free_counter);
//printf("Free Counter: %d\n", free_counter);
}
void signal_handler(int sig)
@ -82,7 +82,7 @@ void signal_handler(int sig)
break;
}
}
/*
static void mtrace_init(void)
{
real_malloc = dlsym(RTLD_NEXT, "malloc");
@ -120,10 +120,10 @@ void free(void *p)
fprintf(stderr, "free: ");
fprintf(stderr, "%p\n", p);
free_counter--;
}
}*/
int main(int argc, char **argv) {
free_counter = 0;
//free_counter = 0;
const char *ubus_socket = NULL;
int ch;
@ -207,7 +207,7 @@ int main(int argc, char **argv) {
return 1;
}
//init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1);
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1);
pthread_create(&tid_probe, NULL, &remove_array_thread, NULL);
pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL);

View file

@ -146,7 +146,7 @@ void *receive_msg_enc(void *args) {
char *dec = gcrypt_decrypt_msg(base64_dec_str, base64_dec_length);
printf("Free %s: %p\n","base64_dec_str", base64_dec_str);
//printf("Free %s: %p\n","base64_dec_str", base64_dec_str);
free(base64_dec_str);
printf("[WC] Network-Received: %s\n", dec);
@ -176,7 +176,7 @@ void *receive_msg_enc(void *args) {
}
}
// free encrypted string
printf("Free %s: %p\n","dec", dec);
//printf("Free %s: %p\n","dec", dec);
free(dec);
}
}
@ -227,9 +227,9 @@ int send_string_enc(char *msg) {
pthread_mutex_unlock(&send_mutex);
exit(EXIT_FAILURE);
}
printf("Free %s: %p\n","base64_enc_str", base64_enc_str);
//printf("Free %s: %p\n","base64_enc_str", base64_enc_str);
free(base64_enc_str);
printf("Free %s: %p\n","enc", enc);
//printf("Free %s: %p\n","enc", enc);
free(enc);
pthread_mutex_unlock(&send_mutex);
return 0;

View file

@ -862,8 +862,8 @@ void print_ap_entry(ap entry) {
char mac_buf_ap[20];
sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(entry.bssid_addr));
printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d\n",
mac_buf_ap, entry.freq, entry.ht, entry.vht);
printf("bssid_addr: %s, freq: %d, ht: %d, vht: %d, ch_utilz: %d\n",
mac_buf_ap, entry.freq, entry.ht, entry.vht, entry.channel_utilization);
}
void print_ap_array() {

View file

@ -479,11 +479,12 @@ int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) {
ap_entry.freq = blobmsg_get_u32(tb[CLIENT_TABLE_FREQ]);
ap_entry.ht = blobmsg_get_u8(tb[CLIENT_TABLE_HT]);
ap_entry.vht = blobmsg_get_u8(tb[CLIENT_TABLE_VHT]);
ap_entry.channel_utilization = blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL]);
insert_to_ap_array(ap_entry);
if((tb[CLIENT_TABLE_CHAN_UTIL]))
{
printf("\n\nCHANNEL UTILIZAITON: %d\n\n", blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL]));
//printf("\n\nCHANNEL UTILIZAITON: %d\n\n", blobmsg_get_u8(tb[CLIENT_TABLE_CHAN_UTIL]));
}
if (do_kick) {