Commit Graph

17 Commits

Author SHA1 Message Date
DL6ER 092a68dedb Remove minor (fre bytes) memory-leaks in resolver code. Ensure to finalize Sqlite3 vector statements during shutdown so valgrind doesn't consider them as "possibly lost" memory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-07-24 09:04:35 +02:00
DL6ER 19cfed227f Fix possible deferencing of NULL pointers
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-07 21:00:01 +01:00
DL6ER 55bf825a81 Implement TOML config file reader/writer and a converter of the pre-v6.0 config file format.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-06-10 12:11:25 +02:00
DL6ER a0a4a7a30f Use specific log routines in api/network.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-05-27 12:08:46 +02:00
DL6ER 3ab46668ca Use specific log routines in vector.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-05-27 12:05:03 +02:00
DL6ER eb8de5f0f2 Fix a memory leak when re-opening the databases (when forking or reloading the lists). The memory leak is on the order of a few bytes but scales quickly with the number of clients. It is caused by SQLite3 not being able to clean up behind itself when we're not finalizing and closing everything explicitly.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-16 11:37:13 +01:00
DL6ER 61fd4209bc Invoking free_sqlite3_stmt_vec() on a NULL pointer should be a harmless no-op.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-05 15:03:18 +02:00
DL6ER 536ef08ce5 Free allocated memory after ordinary termination of TCP workers (TCP connection closed)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 15:11:32 +02:00
DL6ER 7d3e960324 Musl's realloc() does not zero any memory. Do this manually.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 14:14:49 +02:00
DL6ER c9eb4a1265 Remove append and delete instructions as we will always identify clients exactly by their IDs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 13:08:02 +02:00
DL6ER 1246f1616e Silently increase size of vector if trying to read out-of-bounds
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 12:46:32 +02:00
DL6ER 3aa6edcf07 Implement process-private prepared gravity database client statements. This fixes an incompatibility across forks when serving TCP traffic using dedicated workers.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-06 12:17:04 +02:00
DL6ER c9c7c27888 Add shared DNS cache for FTL. This cache is shared across forks and can be used by TCP and UDP clients avoiding any doubled amount of work.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-30 14:08:22 +00:00
DL6ER 8d28bf4b55 Remove commented out generic vector implementation.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-11 21:19:41 +00:00
DL6ER faac7005d1 Improve performance significantly. We store if (and if: why) a certain domain was blocked for any requesting client and can immediately reply similarly if the same client requests the same domain again. This reduces the O(N^3) problem (number of queries * number of domains * number of clients) to a O(N^2) problem (domains * clients). Note that this state of the code still lacks a possibility to reset when entries in the database have changed. For this, we still have to send either SIGHUP (drawback: clears the cache) or define a new signal for it.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-22 09:42:06 +01:00
DL6ER 7fd801dbc2 Add pure attribute to vGet() to signal that this function might be eliminated without consequences in static data flow analysis.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-21 12:18:53 +01:00
DL6ER 0baa56c3c3 Add a generic dynamic vector implementation. I tested my implementation using gdb and also against valgrind to ensure there are no memory leaks.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-11-21 12:12:26 +01:00