]> git.sur5r.net Git - i3/i3/commitdiff
Fix wrong call to free
authorOrestis Floros <orestisf1993@gmail.com>
Sat, 16 Sep 2017 21:24:15 +0000 (00:24 +0300)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 19 Sep 2017 13:46:28 +0000 (15:46 +0200)
To confirm, assign n to a constant value and try to use the
append_layout command.

Without the change i3 crashes.

src/util.c

index cd5ee03e49e607f689f265a95bcb9acc64cbdbcc..ba0969c729674aabe3dd04a0ce9614803514f4f7 100644 (file)
@@ -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;
     }