From 4ed6a6d75aa636c58e85a153d1254b1ba2f3c9c3 Mon Sep 17 00:00:00 2001 From: sw1tchbl4d3 Date: Sun, 18 Jul 2021 23:34:31 +0200 Subject: [PATCH] Fix memory leak in getconf() As getline() calls malloc() to allocate new memory for our usage, we have to free() it after. --- rdo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rdo.c b/rdo.c index bcb1862..3016396 100644 --- a/rdo.c +++ b/rdo.c @@ -24,6 +24,7 @@ void getconf(FILE* fp, const char* entry, char* result, size_t len_result) { if (token) { strncpy(result, token, len_result); result[strcspn(result, "\n")] = 0; + free(line); return; } }