From f7a7c7778ba987c30276d2c30bd99b5e2a495909 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sun, 17 Sep 2017 00:24:15 +0300 Subject: [PATCH] Fix wrong call to free To confirm, assign n to a constant value and try to use the append_layout command. Without the change i3 crashes. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index cd5ee03e..ba0969c7 100644 --- a/src/util.c +++ b/src/util.c @@ -501,7 +501,7 @@ ssize_t slurp(const char *path, char **buf) { fclose(f); if ((ssize_t)n != stbuf.st_size) { ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size); - free(buf); + free(*buf); *buf = NULL; return -1; }