From 3b7f546d0d0eed3ca225f1cb9f826876cfe2c3db Mon Sep 17 00:00:00 2001 From: viandoxdev Date: Wed, 12 Oct 2022 19:40:53 +0200 Subject: [PATCH] fix memory leak --- Makefile | 9 ++------- server.c | 2 ++ server_config.json | 4 ++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8a046bd..ab0e31d 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,8 @@ Q=@ CC=clang GCCCFLAGS=-Wno-format-truncation -CLANGCFLAGS=-fsanitize=memory -CFLAGS=-std=c11 -pedantic -g -Wall -pthread -D_GNU_SOURCE -LDFLAGS=-lm -fsanitize=memory +CFLAGS=-std=c11 -pedantic -g -Wall -pthread -D_GNU_SOURCE -fsanitize=address +LDFLAGS=-lm -fsanitize=address BUILD_DIR=./objects BIN=jsfw @@ -19,10 +18,6 @@ ifeq ($(CC),gcc) CFLAGS:=$(CFLAGS) $(GCCCFLAGS) endif -ifeq ($(CC),clang) - CFLAGS:=$(CFLAGS) $(CLANGCFLAGS) -endif - .PHONY: run run: $(BIN) @echo "RUN $(BIN) $(RUNARGS)" diff --git a/server.c b/server.c index 06e3643..94d2164 100644 --- a/server.c +++ b/server.c @@ -345,6 +345,8 @@ conn_end: pthread_join(thread, NULL); } free(args); + vec_free(device_threads); + vec_free(device_controllers); return NULL; } diff --git a/server_config.json b/server_config.json index 3ba51a5..312e492 100644 --- a/server_config.json +++ b/server_config.json @@ -3,6 +3,10 @@ { "filter": { "name": "SteelSeries SteelSeries Rival 310 eSports Mouse" }, "tag": "Mouse" + }, + { + "filter": { "name": "Logitech Gaming Mouse G502" }, + "tag": "Mouse" } ], "poll_interval": 1