From ebacc98fb26b4a505ee3e67caad991edd2e86bd3 Mon Sep 17 00:00:00 2001 From: Georges Da Costa <dacosta@irit.fr> Date: Tue, 5 May 2020 01:05:13 +0200 Subject: [PATCH] cleanup with valgrind --- makefile | 8 ++++---- network.c | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index 90e019f..1ff338f 100644 --- a/makefile +++ b/makefile @@ -10,21 +10,21 @@ mojitos_group: $(OBJECTS_GRP) counters_option.h gcc $(DEBUG) -O3 -Wall -o mojitos_group $(OBJECTS_GRP) -lpowercap counters_%.o: counters_%.c counters.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ counters_option.h: counters_option.py ./counters_option.py > counters_option.h mojitos.o: mojitos.c counters_option.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ -debug: DEBUG = -DDEBUG +debug: DEBUG = -DDEBUG -g debug: all %.o : %.c %.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ clean: \rm -f *~ *.o mojitos_group mojitos counters_option.h diff --git a/network.c b/network.c index 0c03cb5..5bab862 100644 --- a/network.c +++ b/network.c @@ -34,6 +34,7 @@ char **init_network(char* dev) { char *end_of_dev = index(buffer, '\t'); *end_of_dev='\0'; dev = buffer; + fclose(f); } char *filenames[] = {"/sys/class/net/%s/statistics/rx_packets", -- GitLab