commit 0871ca2495bf9c2da527e17033b00c5bb92e4000
parent d587fb51a38ce982a685edfd6396f782da34f2f7
Author: Allis IO <0xa111510@gmail.com>
Date: Wed, 22 Apr 2020 09:25:14 -0400
Let getline() handle buffer allocation in get_memory()
This is a little nitpicky, but paleofetch is Valgrind-clean modulo this
line. It is the right way to use `getline()`, though, which expects a
null buffer that it can grow and shrink as necessary.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -187,7 +187,7 @@ char *get_memory() {
}
/* We parse through all lines of meminfo and scan for the information we need */
- char *line = malloc(BUF_SIZE);
+ char *line = NULL; // allocation handled automatically by getline()
size_t len; /* unused */
/* parse until EOF */