Debug free() error on rrh

This commit is contained in:
Quentin Dufour 2019-04-03 09:54:52 +02:00
parent e1084026b0
commit aa3d235bd6
3 changed files with 14 additions and 6 deletions

View file

@ -3,7 +3,7 @@ mkdir -p ./log
tor -f /etc/torrc > ./log/client-tor-stdout.log 2> ./log/client-tor-stderr.log &
sleep 2
mkdir -p ./shared
donar -a rr -b -h -c -o ./shared/onion_services.pub -r 9000 > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
valgrind --leak-check=full donar -a rr -b -h -c -o ./shared/onion_services.pub -r 9000 > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
sleep 2
measlat -h 127.13.3.7 -p 9000 > /dev/null 2>&1 # Used to wait for connections
measlat -h 127.13.3.7 -p 9000 -c $1 -i $2 -s $3 > ./res/rrh.csv 2> ./log/client-measlat-stderr.log

View file

@ -5,5 +5,5 @@ sleep 2
mkdir -p ./shared
cd ./shared
pwd
donar -a rr -b -h -s -e 9000 > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
valgrind --leak-check=full donar -a rr -b -h -s -e 9000 > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
udpecho -p 9000 > ../log/server-udpecho-stdout.log 2> ../log/server-udpecho-stderr.log

View file

@ -3,8 +3,15 @@
void free_fdinfo(void* v) {
struct evt_core_fdinfo* fdinfo = (struct evt_core_fdinfo*)v;
close(fdinfo->fd); // We close the file descriptor here
if (fdinfo->url != NULL) free(fdinfo->url); // We free the URL here;
if (fdinfo->free_other != NULL) fdinfo->free_other(fdinfo->other);
fprintf(stderr, "Freeing fdinfo for %s\n", fdinfo->url);
if (fdinfo->free_other != NULL) {
fprintf(stderr, "Freeing fdinfo->other for %s\n", fdinfo->url);
fdinfo->free_other(fdinfo->other);
}
if (fdinfo->url != NULL) {
fprintf(stderr, "Freeing fdinfo->url for %s\n", fdinfo->url);
free(fdinfo->url); // We free the URL here;
}
free(v);
}
@ -159,8 +166,9 @@ struct evt_core_cat* evt_core_rm_fd(struct evt_core_ctx* ctx, int fd) {
g_hash_table_remove(ctx->socklist, &fd); // Will be free here
// 4. Close and remove file descriptor
epoll_ctl(ctx->epollfd, EPOLL_CTL_DEL, fd, NULL);
close(fd);
// Done in free_fdinfo
//epoll_ctl(ctx->epollfd, EPOLL_CTL_DEL, fd, NULL);
//close(fd);
// 5. Return file descriptor's category
return cat;